diff --git a/Dockerfile b/Dockerfile index e844fdb..05cbabd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,6 +68,11 @@ RUN sed -i 's/LoadModule mpm_prefork_module/#LoadModule mpm_prefork_module/g' /e # PHP-FPM config COPY vhost.conf /etc/apache2/conf.d/vhost.conf +# Make sure apache can read&right to logs and docroot +RUN chown -R apache:apache /var/log/apache2 /var/www +### Execute as Apache user ### +USER apache + # Define Grav specific version of Grav or use latest stable ENV GRAV_VERSION latest @@ -81,15 +86,13 @@ RUN curl -o grav-admin.zip -SL https://getgrav.org/download/core/grav-admin/${GR # Create cron job for Grav maintenance scripts RUN (crontab -l; echo "* * * * * cd /var/www/html;/usr/local/bin/php bin/grav scheduler 1>> /dev/null 2>&1") | crontab - -RUN chown -R apache:apache /var/log/apache2 /var/www - # Accept incoming HTTP requests EXPOSE 80 -# Return to root user +### Return to root user ### USER root -# provide container inside image for data persistence +# Provide container inside image for data persistence VOLUME ["/var/www"] COPY run.sh /run.sh diff --git a/run.sh b/run.sh index 2d96d4b..de32946 100644 --- a/run.sh +++ b/run.sh @@ -1,5 +1,7 @@ #!/bin/sh +# Make sure apache can read&right to /var/www +RUN chown -R apache:apache /var/log/apache2 /var/www # Start PHP-FPM and Apache exec /usr/sbin/httpd -D FOREGROUND -f /etc/apache2/httpd.conf & exec /usr/sbin/php-fpm7 -F \ No newline at end of file