forked from behance/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile-7.4-alpine
137 lines (131 loc) · 4.26 KB
/
Dockerfile-7.4-alpine
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
FROM behance/docker-nginx:9.0-alpine
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
# Set TERM to suppress warning messages.
ENV CONF_PHPFPM=/etc/php7/php-fpm.conf \
CONF_PHPMODS=/etc/php7/conf.d \
CONF_FPMPOOL=/etc/php7/php-fpm.d/www.conf \
CONF_FPMOVERRIDES=/etc/php/7.0/fpm/conf.d/overrides.user.ini \
APP_ROOT=/app \
SERVER_WORKER_CONNECTIONS=3072 \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_CLIENT_HEADER_BUFFER_SIZE=1k \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_LARGE_CLIENT_HEADER_BUFFERS="4 256k" \
PHP_FPM_MAX_CHILDREN=4096 \
PHP_FPM_START_SERVERS=20 \
PHP_FPM_MAX_REQUESTS=1024 \
PHP_FPM_MIN_SPARE_SERVERS=5 \
PHP_FPM_MAX_SPARE_SERVERS=128 \
PHP_FPM_MEMORY_LIMIT=256M \
PHP_FPM_MAX_EXECUTION_TIME=60 \
PHP_FPM_UPLOAD_MAX_FILESIZE=1M \
PHP_OPCACHE_MEMORY_CONSUMPTION=128 \
PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE=5 \
PHP_OPCACHE_ENABLE_CLI=1 \
PHP_ENGINE_VERSION=20180731 \
CFG_APP_DEBUG=1
COPY ./scripts /scripts
# - Update packages
# - Add PHP and support packages
# - Install NewRelic
# - Compile extensions
# - Enable/disable default extensions
# - Cleanup
RUN apk update && \
apk add --no-cache \
git \
curl \
wget \
php7 \
php7-bcmath \
php7-bz2 \
php7-fpm \
php7-apcu \
php7-calendar \
php7-common \
php7-ctype \
php7-curl \
php7-dom \
php7-exif \
php7-ftp \
php7-gd \
php7-gettext \
php7-iconv \
php7-intl \
php7-json \
php7-mcrypt \
php7-mbstring \
# php7-msgpack@edge \
# php7-memcached@community \
php7-mysqli \
php7-mysqlnd \
php7-opcache \
php7-openssl \
php7-pdo_pgsql \
php7-pgsql \
php7-pcntl \
php7-pdo \
php7-pdo_mysql \
php7-phar \
php7-posix \
php7-session \
php7-simplexml \
php7-sockets \
php7-sysvmsg \
php7-sysvsem \
php7-sysvshm \
php7-shmop \
php7-tokenizer \
php7-xdebug \
php7-xml \
php7-xmlreader \
php7-xmlwriter \
php7-xsl \
php7-zip \
php7-zlib \
# below required to compile non-packaged extensions
yaml-dev \
zlib-dev \
libmemcached-dev \
cyrus-sasl-dev \
&& \
apk add --no-cache --virtual .phpize_deps \
autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \
&& \
sed -i 's/^exec $PHP -C -n/exec $PHP -C/g' $(which pecl) && \
pecl install igbinary && \
echo "extension=igbinary.so" > $CONF_PHPMODS/igbinary.ini && \
pecl install yaml && \
echo ";extension=yaml.so" > $CONF_PHPMODS/yaml.ini && \
pecl install redis && \
echo ";extension=redis.so" > $CONF_PHPMODS/redis.ini && \
pecl install msgpack && \
echo "extension=msgpack.so" > $CONF_PHPMODS/msgpack.ini && \
pecl install memcached && \
echo "extension=memcached.so" > $CONF_PHPMODS/memcached.ini && \
# Disable xdebug by default \
sed -i 's/zend_extension\s\?=/;zend_extension =/' $CONF_PHPMODS/50_xdebug.ini && \
# Disable postgres by default \
sed -i 's/extension/;extension/' $CONF_PHPMODS/01_pdo_pgsql.ini && \
sed -i 's/extension/;extension/' $CONF_PHPMODS/00_pgsql.ini \
&& \
/bin/bash -e /scripts/install-newrelic-alpine.sh && \
/bin/bash -e /scripts/install-composer.sh && \
apk del .phpize_deps && \
# rm -rf /usr/share/php7 && \
/bin/bash -e /clean.sh
# Overlay the root filesystem from this repo
COPY ./container/root /
# - Make additional hacks to migrate files from Ubuntu to Alpine folder structure
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
rm $CONF_PHPMODS/00_opcache.ini && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
chown $NOT_ROOT_USER:$NOT_ROOT_USER /var/log/php7 && \
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \
/bin/bash -e /scripts/prep-php.sh
# HACK: workaround for /~https://github.com/aelsabbahy/goss/issues/392
# Run the child and parent test configs separately instead of leveraging inheritance
RUN goss -g /tests/php-fpm/7.4-alpine.goss.yaml validate && \
goss -g /tests/php-fpm/base.goss.yaml validate && \
/aufs_hack.sh