-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile-fpm
81 lines (65 loc) · 3.07 KB
/
Dockerfile-fpm
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
76
77
78
79
80
81
# syntax=docker/dockerfile:experimental
FROM php:7.2-fpm-alpine3.7 as fpm
ENV FCGI_CONNECT=/var/run/php-fpm.sock
ENV PHP_FPM_PM=dynamic
ENV PHP_FPM_PM_MAX_CHILDREN=5
ENV PHP_FPM_PM_START_SERVERS=2
ENV PHP_FPM_PM_MIN_SPARE_SERVERS=1
ENV PHP_FPM_PM_MAX_SPARE_SERVERS=3
ENV PHP_FPM_PM_PROCESS_IDLE_TIMEOUT=10
ENV PHP_FPM_PM_MAX_REQUESTS=0
ENV PHP_FPM_ACCESS_FORMAT %R - %u %t \\\"%m %r\\\" %s
# Add usabilla user and group
RUN set -x \
&& addgroup -g 1000 app \
&& adduser -u 1000 -D -G app app \
# Temporary fix: pulls in the aports patch for https://bugs.alpinelinux.org/issues/10648
&& apk add --no-cache --upgrade apk-tools
# Install docker help scripts
COPY src/php/utils/docker/ /usr/local/bin/
COPY src/php/utils/install-* /usr/local/bin/
# Install PHP extensions
# hadolint ignore=DL4006
RUN set -x \
# Install curl-dev in order to address the curl binary issue in some Alpine versions
&& apk add --no-cache curl-dev \
# Adding sodium purely for the 7.1 image, it's already in 7.2 and up: https://www.php.net/manual/en/sodium.installation.php \
&& apk add --no-cache wget gettext \
&& if [ $(php -v | grep "PHP 7.1" | wc -l) != 0 ] ; then apk add --no-cache libsodium-dev; else true; fi \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& docker-php-ext-install opcache \
&& pecl install apcu \
&& if [ $(php -v | grep "PHP 7.1" | wc -l) != 0 ] ; then pecl install libsodium; else true; fi \
&& pecl clear-cache \
&& docker-php-ext-enable apcu \
&& docker-php-ext-enable sodium \
# those deletions happen since the helper scripts nor the official image are removing them
&& docker-php-source-tarball clean && (rm /usr/local/bin/phpdbg || true) && rm -rf /tmp/pear ~/.pearrc \
&& apk del .phpize-deps \
&& apk add --no-cache fcgi \
# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-11068 (libxslt)
&& apk upgrade --no-cache curl libxml2 libxslt \
# Create a symlink to the recommended production configuration
# ref: https://github.com/docker-library/docs/tree/master/php#configuration
&& ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY src/gpg /usr/local/etc/gpg
COPY src/php/conf/ /usr/local/etc/php/conf.d/
COPY src/php/fpm/conf/*.conf.* /usr/local/etc/php-fpm.d/
# Remove configuration files which are templated during the entrypoint command
RUN rm /usr/local/etc/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/www.conf.default
# Install shush, dumb-init and composer
RUN install-shush && rm -f /usr/local/bin/install-shush \
&& install-dumb-init && rm -f /usr/local/bin/install-dumb-init \
&& install-composer && rm -f /usr/local/bin/install-composer
STOPSIGNAL SIGTERM
ENTRYPOINT [ "docker-php-entrypoint-init" ]
CMD ["--force-stderr"]
# Base images don't need healthcheck since they are not running applications
# this can be overriden in the child images
HEALTHCHECK NONE
VOLUME [ "/var/run" ]
## FPM-DEV STAGE ##
FROM fpm as fpm-dev
# Install Xdebug and development specific configuration
RUN docker-php-dev-mode xdebug \
&& docker-php-dev-mode config