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 <container> /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.
This commit is contained in:
parent
c5ee3da9aa
commit
02c559e868
19
Dockerfile
19
Dockerfile
|
|
@ -1,4 +1,4 @@
|
||||||
FROM php:7.2-apache
|
FROM php:7.3-apache
|
||||||
LABEL maintainer="Andy Miller <rhuk@getgrav.org> (@rhukster)"
|
LABEL maintainer="Andy Miller <rhuk@getgrav.org> (@rhukster)"
|
||||||
|
|
||||||
# Enable Apache Rewrite + Expires Module
|
# Enable Apache Rewrite + Expires Module
|
||||||
|
|
@ -11,6 +11,9 @@ RUN apt-get update && apt-get install -y \
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
libyaml-dev \
|
libyaml-dev \
|
||||||
|
libzip-dev \
|
||||||
|
cron \
|
||||||
|
vim \
|
||||||
&& docker-php-ext-install opcache \
|
&& docker-php-ext-install opcache \
|
||||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
&& 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 -j$(nproc) gd \
|
||||||
|
|
@ -29,9 +32,6 @@ RUN { \
|
||||||
echo 'post_max_size=128M'; \
|
echo 'post_max_size=128M'; \
|
||||||
} > /usr/local/etc/php/conf.d/php-recommended.ini
|
} > /usr/local/etc/php/conf.d/php-recommended.ini
|
||||||
|
|
||||||
# provide container inside image for data persistance
|
|
||||||
# VOLUME /var/www/html
|
|
||||||
|
|
||||||
RUN pecl install apcu \
|
RUN pecl install apcu \
|
||||||
&& pecl install yaml \
|
&& pecl install yaml \
|
||||||
&& docker-php-ext-enable apcu yaml
|
&& docker-php-ext-enable apcu yaml
|
||||||
|
|
@ -41,8 +41,8 @@ RUN chown www-data:www-data /var/www
|
||||||
USER www-data
|
USER www-data
|
||||||
|
|
||||||
# Define Grav version and expected SHA1 signature
|
# Define Grav version and expected SHA1 signature
|
||||||
ENV GRAV_VERSION 1.5.5
|
ENV GRAV_VERSION 1.6.16
|
||||||
ENV GRAV_SHA1 af0433facdae1afeb1d973a66db2315c5022b10d
|
ENV GRAV_SHA1 4fbb140fcf110c692a9d8102041c3f26b2fca9da
|
||||||
|
|
||||||
# Install grav
|
# Install grav
|
||||||
WORKDIR /var/www
|
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 && \
|
mv -T /var/www/grav-admin /var/www/html && \
|
||||||
rm grav-admin.zip
|
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
|
# Return to root user
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Copy init scripts
|
# Copy init scripts
|
||||||
# COPY docker-entrypoint.sh /entrypoint.sh
|
# COPY docker-entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
# provide container inside image for data persistance
|
||||||
|
VOLUME ["/var/www/html"]
|
||||||
|
|
||||||
# ENTRYPOINT ["/entrypoint.sh"]
|
# ENTRYPOINT ["/entrypoint.sh"]
|
||||||
# CMD ["apache2-foreground"]
|
# CMD ["apache2-foreground"]
|
||||||
|
CMD ["sh", "-c", "cron && apache2-foreground"]
|
||||||
|
|
|
||||||
28
README.md
28
README.md
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
This currently is pretty minimal and uses:
|
This currently is pretty minimal and uses:
|
||||||
|
|
||||||
* apache-2.4.8
|
* apache-2.4.38
|
||||||
* GD library
|
* GD library
|
||||||
* Unzip library
|
* Unzip library
|
||||||
* php7.2
|
* php7.3
|
||||||
* php7.2-opcache
|
* php7.3-opcache
|
||||||
* php7.2-acpu
|
* php7.3-acpu
|
||||||
* php7.2-yaml
|
* php7.3-yaml
|
||||||
|
* cron
|
||||||
|
* vim editor
|
||||||
|
|
||||||
## Building the image from Dockerfile
|
## Building the image from Dockerfile
|
||||||
|
|
||||||
|
|
@ -16,7 +18,7 @@ This currently is pretty minimal and uses:
|
||||||
docker build -t grav:latest .
|
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
|
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...
|
Point browser to `http://localhost:8000` and create user account...
|
||||||
|
|
||||||
## Running local Grav installation
|
## Running Grav Image with Latest Grav + Admin with a named volume (can be used in production)
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
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
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue