Moving to PHP 7.2; also added https://github.com/evnsio/grav 's startup script

This commit is contained in:
William Miceli
2019-03-15 17:12:26 -04:00
parent 0397f2068a
commit fc6561aaf4
2 changed files with 58 additions and 2 deletions

View File

@@ -4,8 +4,17 @@ FROM nginx:stable
ARG GRAV_VERSION=1.5.8 ARG GRAV_VERSION=1.5.8
# Install dependencies # Install dependencies
RUN apt-get update && \ RUN add-apt-repository ppa:ondrej/php && \ # For PHP 7.2
apt-get install -y sudo wget vim unzip php5 php5-curl php5-gd php-pclzip php5-fpm apt-get update && \
apt-get install -y sudo wget unzip php-pclzip && \
# Install PHP 7.2 and Required Modules for Grav
apt-get install -y \
php7.2 \
php7.2-curl \
php7.2-gd # \
# php7.2-json \
# php7.2-mbstring \
ADD https://github.com/krallin/tini/releases/download/v0.13.2/tini /usr/local/bin/tini ADD https://github.com/krallin/tini/releases/download/v0.13.2/tini /usr/local/bin/tini
RUN chmod +x /usr/local/bin/tini RUN chmod +x /usr/local/bin/tini

View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
function configure_admin() {
export GRAV_HOME=/var/www/grav-admin
# Setup admin user (if supplied)
if [ -z $ADMIN_USER ]; then
echo "[ INFO ] No Grav admin user details supplied"
else
if [ -e $GRAV_HOME/user/accounts/$ADMIN_USER.yaml ]; then
echo "[ INFO ] Grav admin user already exists"
else
echo "[ INFO ] Setting up Grav admin user"
cd $GRAV_HOME
sudo -u www-data bin/plugin login newuser \
--user=${ADMIN_USER} \
--password=${ADMIN_PASSWORD-"Pa55word"} \
--permissions=${ADMIN_PERMISSIONS-"b"} \
--email=${ADMIN_EMAIL-"admin@domain.com"} \
--fullname=${ADMIN_FULLNAME-"Administrator"} \
--title=${ADMIN_TITLE-"SiteAdministrator"}
fi
fi
}
function configure_nginx() {
echo "[ INFO ] Configuring Nginx"
echo "[ INFO ] > Updating to listen on port 80"
sed -i 's/#listen 80;/listen 80;/g' /etc/nginx/conf.d/default.conf
}
function start_services() {
echo "[ INFO ] Starting nginx"
bash -c 'php5-fpm -D; nginx -g "daemon off;"'
}
function main() {
configure_admin
configure_nginx
start_services
}
main "$@"