-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathDockerfile
75 lines (62 loc) · 2.23 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
63
64
65
66
67
68
69
70
71
72
73
74
75
# Alpine Image for Nginx and PHP
# NGINX x ALPINE.
FROM nginx:1.17.5-alpine
# MAINTAINER OF THE PACKAGE.
LABEL maintainer="Neo Ighodaro <[email protected]>"
# INSTALL SOME SYSTEM PACKAGES.
RUN apk --update --no-cache add ca-certificates \
bash \
supervisor
# trust this project public key to trust the packages.
ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
# CONFIGURE ALPINE REPOSITORIES AND PHP BUILD DIR.
ARG PHP_VERSION=7.3
ARG ALPINE_VERSION=3.9
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" > /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" >> /etc/apk/repositories && \
echo "https://dl.bintray.com/php-alpine/v${ALPINE_VERSION}/php-${PHP_VERSION}" >> /etc/apk/repositories
# INSTALL PHP AND SOME EXTENSIONS. SEE: https://github.com/codecasts/php-alpine
RUN apk add --no-cache --update php-fpm \
php \
php-openssl \
php-pdo \
php-pdo_mysql \
php-mbstring \
php-phar \
php-session \
php-dom \
php-ctype \
php-zlib \
php-json \
php-xml && \
ln -s /usr/bin/php7 /usr/bin/php
# CONFIGURE WEB SERVER.
RUN mkdir -p /var/www && \
mkdir -p /run/php && \
mkdir -p /run/nginx && \
mkdir -p /var/log/supervisor && \
mkdir -p /etc/nginx/sites-enabled && \
mkdir -p /etc/nginx/sites-available && \
rm /etc/nginx/nginx.conf && \
rm /etc/php7/php-fpm.d/www.conf && \
rm /etc/php7/php.ini
# INSTALL COMPOSER.
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
# ADD START SCRIPT, SUPERVISOR CONFIG, NGINX CONFIG AND RUN SCRIPTS.
ADD start.sh /start.sh
ADD config/supervisor/supervisord.conf /etc/supervisord.conf
ADD config/nginx/nginx.conf /etc/nginx/nginx.conf
ADD config/nginx/site.conf /etc/nginx/sites-available/default.conf
ADD config/php/php.ini /etc/php7/php.ini
ADD config/php-fpm/www.conf /etc/php7/php-fpm.d/www.conf
RUN chmod 755 /start.sh
# EXPOSE PORTS!
ARG NGINX_HTTP_PORT=80
ARG NGINX_HTTPS_PORT=443
EXPOSE ${NGINX_HTTPS_PORT} ${NGINX_HTTP_PORT}
# SET THE WORK DIRECTORY.
WORKDIR /var/www
#GRANT PRIVILEGIES TO www-data user:group to read in /var/www
RUN chown -R www-data:www-data /var/www
# KICKSTART!
CMD ["/start.sh"]