From c5ee3da9aa097d9e103021126c6592556c8a7695 Mon Sep 17 00:00:00 2001 From: Philipp Wallrich Date: Tue, 1 Oct 2019 20:19:27 +0200 Subject: [PATCH 1/4] updated Readme (#6) http://localhost/8000 should be http://localhost:8000, at least on my machine --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef44a85..b0a16d8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ docker build -t grav:latest . docker run -p 8000:80 grav:latest ``` -Point browser to `http://localhost/8000` and create user account... +Point browser to `http://localhost:8000` and create user account... ## Running local Grav installation @@ -38,4 +38,4 @@ To run in the current directory you can use: docker run -v `pwd`:/var/www/html:cached -p 8000:80/tcp grav:latest ``` -Point browser to `http://localhost/8000` to access your Grav site +Point browser to `http://localhost:8000` to access your Grav site From 02c559e868c20a4e4d0fd5824a3b8e08919ec2db Mon Sep 17 00:00:00 2001 From: eloquentcarbon <55666588+eloquentcarbon@users.noreply.github.com> Date: Wed, 22 Jan 2020 14:31:37 -0500 Subject: [PATCH 2/4] Update to version 1.6.16 and make production use ready (#17) * Update to php:7.3-apache base docker image * Update Grav version to 1.6.16 Add missing libzip-dev dependency. * Add persistent volume * Add cron support * Add vi editor Allows editing files when using `docker exec -it /bin/bash` * Correct vi editor install * Updated README.md for version 1.6.16 Since the data volume is automatically persisted removed the extra information regarding volume mapping. --- Dockerfile | 19 +++++++++++++------ README.md | 28 ++++++++++------------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index cde8da9..8762001 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.2-apache +FROM php:7.3-apache LABEL maintainer="Andy Miller (@rhukster)" # Enable Apache Rewrite + Expires Module @@ -11,6 +11,9 @@ RUN apt-get update && apt-get install -y \ libjpeg62-turbo-dev \ libpng-dev \ libyaml-dev \ + libzip-dev \ + cron \ + vim \ && docker-php-ext-install opcache \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd \ @@ -29,9 +32,6 @@ RUN { \ echo 'post_max_size=128M'; \ } > /usr/local/etc/php/conf.d/php-recommended.ini - # provide container inside image for data persistance -# VOLUME /var/www/html - RUN pecl install apcu \ && pecl install yaml \ && docker-php-ext-enable apcu yaml @@ -41,8 +41,8 @@ RUN chown www-data:www-data /var/www USER www-data # Define Grav version and expected SHA1 signature -ENV GRAV_VERSION 1.5.5 -ENV GRAV_SHA1 af0433facdae1afeb1d973a66db2315c5022b10d +ENV GRAV_VERSION 1.6.16 +ENV GRAV_SHA1 4fbb140fcf110c692a9d8102041c3f26b2fca9da # Install grav WORKDIR /var/www @@ -52,11 +52,18 @@ RUN curl -o grav-admin.zip -SL https://getgrav.org/download/core/grav-admin/${GR mv -T /var/www/grav-admin /var/www/html && \ rm grav-admin.zip +# 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 - + # Return to root user USER root # Copy init scripts # COPY docker-entrypoint.sh /entrypoint.sh +# provide container inside image for data persistance +VOLUME ["/var/www/html"] + # ENTRYPOINT ["/entrypoint.sh"] # CMD ["apache2-foreground"] +CMD ["sh", "-c", "cron && apache2-foreground"] diff --git a/README.md b/README.md index b0a16d8..9b8877f 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,15 @@ This currently is pretty minimal and uses: -* apache-2.4.8 +* apache-2.4.38 * GD library * Unzip library -* php7.2 -* php7.2-opcache -* php7.2-acpu -* php7.2-yaml +* php7.3 +* php7.3-opcache +* php7.3-acpu +* php7.3-yaml +* cron +* vim editor ## Building the image from Dockerfile @@ -16,7 +18,7 @@ This currently is pretty minimal and uses: docker build -t grav:latest . ``` -## Running Grav Image with Latest Grav + Admin (not persistent): +## Running Grav Image with Latest Grav + Admin: ``` docker run -p 8000:80 grav:latest @@ -24,18 +26,8 @@ docker run -p 8000:80 grav:latest Point browser to `http://localhost:8000` and create user account... -## Running local Grav installation - -This assumes you have already downloaded a Grav package into a local folder. This is the best way to run Grav if you want to have your changes persisted between restarts of the docker container. +## Running Grav Image with Latest Grav + Admin with a named volume (can be used in production) ``` -docker run -v /local/grav/install:/var/www/html:cached -p 8000:80/tcp grav:latest +docker run -d -p 8000:80 --name grav --restart always -v grav_data:/var/www/html grav:1.0 ``` - -To run in the current directory you can use: - -``` -docker run -v `pwd`:/var/www/html:cached -p 8000:80/tcp grav:latest -``` - -Point browser to `http://localhost:8000` to access your Grav site From d94c4836e7f6d426729af0d62993d1059eac6b1d Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 22 Jan 2020 20:32:19 +0100 Subject: [PATCH 3/4] optimize apt-get step (#18) source: https://www.fromlatest.io/#/ Line 8: Consider `--no-install-recommends` (Optimization) Consider using a --no-install-recommends when apt-get installing packages. This will result in a smaller image size. Line 8: apt-get update with matching cache rm (Optimization) Use of apt-get update should be paired with rm -rf /var/lib/apt/lists/* in the same layer. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8762001..c7712c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ LABEL maintainer="Andy Miller (@rhukster)" RUN a2enmod rewrite expires # Install dependencies -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ unzip \ libfreetype6-dev \ libjpeg62-turbo-dev \ @@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-install zip + && rm -rf /var/lib/apt/lists/* # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php From fb824bc18bad1cabff9616ce9a250ffe570fb68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joda=20St=C3=B6=C3=9Fer?= Date: Wed, 22 Jan 2020 20:33:17 +0100 Subject: [PATCH 4/4] Update Grav to current version (incrementally) (#16) * Updated Grav version to 1.5.6 * Updated Grav version to 1.5.7 * Updated Grav version to 1.5.8 * Updated Grav version to 1.5.9 * Updated Grav version to 1.5.10 * Updated Grav version to 1.6.0 * Updated Grav version to 1.6.1 * Updated Grav version to 1.6.2 * Updated Grav version to 1.6.3 * Updated Grav version to 1.6.4 * Updated Grav version to 1.6.5 * Updated Grav version to 1.6.6 * Updated Grav version to 1.6.7 * Updated Grav version to 1.6.8 * Updated Grav version to 1.6.9 * Updated Grav version to 1.6.10 * Updated Grav version to 1.6.11 * Updated Grav version to 1.6.12 * Updated Grav version to 1.6.13 * Updated Grav version to 1.6.14 * Updated Grav version to 1.6.15 * Updated Grav version to 1.6.16 * Updated Grav version to 1.6.17 * Updated Grav version to 1.6.18 * Updated Grav version to 1.6.19 Co-authored-by: Andy Miller <1084697+rhukster@users.noreply.github.com> --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7712c3..2a1bf5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,8 +42,9 @@ RUN chown www-data:www-data /var/www USER www-data # Define Grav version and expected SHA1 signature -ENV GRAV_VERSION 1.6.16 -ENV GRAV_SHA1 4fbb140fcf110c692a9d8102041c3f26b2fca9da +ENV GRAV_VERSION 1.6.19 +ENV GRAV_SHA1 231e6789e9575adccd6044aa0d0c72b8c2603a96 + # Install grav WORKDIR /var/www