-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (51 loc) · 1.84 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM nginx:latest
LABEL maintainer="gushmazuko <gushmazuko@protonmail.com>"
LABEL description="Docker Image for Grav based on NGINX"
# Install dependencies
RUN apt update && apt install -y --no-install-recommends \
vim\
zip \
unzip \
git \
php-fpm \
php-cli \
php-gd \
php-curl \
php-mbstring \
php-xml \
php-zip \
php-apcu \
cron
# Configure PHP FPM
# https://learn.getgrav.org/17/webservers-hosting/vps/digitalocean#configure-php7-2-fpm
RUN sed -i "s/.*cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.*/fpm/php.ini
# Set user to www-data
RUN chown www-data:www-data /usr/share/nginx
RUN rm -rf /usr/share/nginx/html
USER www-data
# Define a specific version of Grav or use latest stable
ENV GRAV_VERSION latest
# Install grav
WORKDIR /usr/share/nginx
RUN curl -o grav-admin.zip -SL https://getgrav.org/download/core/grav-admin/${GRAV_VERSION} && \
unzip grav-admin.zip && \
mv -T /usr/share/nginx/grav-admin /usr/share/nginx/html && \
rm grav-admin.zip && \
rm /usr/share/nginx/html/index.html
# Create cron job for Grav maintenance scripts
# https://learn.getgrav.org/17/advanced/scheduler
RUN (crontab -l; echo "* * * * * cd /usr/share/nginx/html;/usr/bin/php bin/grav scheduler 1>> /dev/null 2>&1") | crontab -
# Return to root user
USER root
# Add nginx to www-data group
RUN usermod -aG www-data nginx
# Replace dafault config files by provided by Grav
# https://learn.getgrav.org/17/webservers-hosting/vps/digitalocean#configure-nginx-connection-pool
RUN rm /etc/php/7.3/fpm/pool.d/www.conf
RUN rm /etc/nginx/conf.d/default.conf
COPY conf/php/grav.conf /etc/php/7.3/fpm/pool.d/
COPY conf/nginx/grav.conf /etc/nginx/conf.d/
# Provide container inside image for data persistence
VOLUME ["/usr/share/nginx/html"]
# Run startup script
CMD bash -c "service php7.3-fpm start && nginx -g 'daemon off;'"