-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile-fpm-alpine
223 lines (221 loc) · 6.7 KB
/
Dockerfile-fpm-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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
ARG PHP_VERSION=8
FROM php:${PHP_VERSION}-fpm-alpine
LABEL org.opencontainers.image.description="PHP base image with commonly used extensions pre-installed" \
"com.koalaphils.vendor"="Koala Software Technology Innovations" \
"com.koalaphils.image.author"="[email protected]"
RUN set -eux; \
apk update \
&& apk add --no-cache \
bash \
c-ares \
freetype \
git \
imagemagick-libs \
libavif \
libcmph \
libedit \
libevent \
libjpeg-turbo \
libmcrypt \
libmemcached \
libmemcached-libs \
libpng \
libsodium \
libuv \
libxpm \
libzip \
lz4-libs \
msgpack-c \
netcat-openbsd \
pcre \
tzdata \
unixodbc \
unzip \
zlib \
; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
build-base \
argon2-dev \
c-ares-dev \
curl-dev \
cyrus-sasl-dev \
freetype-dev \
gettext-dev \
icu-dev \
imagemagick-dev \
jpeg-dev \
libavif-dev \
libedit-dev \
libevent-dev \
libjpeg-turbo-dev \
libmcrypt-dev \
libmemcached-dev \
linux-headers \
libpng-dev \
libsodium-dev \
libuv-dev \
libwebp-dev \
libxml2-dev \
libxpm-dev \
libzip-dev \
lz4-dev \
msgpack-c-dev \
oniguruma-dev \
openssl-dev \
pcre-dev \
unixodbc-dev \
zlib-dev \
${PHP_EXTRA_BUILD_DEPS:-} \
; export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
; \
docker-php-ext-configure gd --with-jpeg --with-xpm --with-webp --with-freetype --with-avif \
; \
docker-php-ext-install -j$(nproc) gd \
; \
docker-php-ext-install -j$(nproc) \
bcmath \
dba \
gettext \
intl \
mysqli \
opcache \
pcntl \
pdo_mysql \
xml \
zip \
; \
rm -rf $PHP_INI_DIR/conf.d/docker-php-ext-*.ini \
; \
docker-php-ext-enable sodium \
; \
docker-php-ext-install -j$(nproc) \
--ini-name 0-docker-php-ext-sockets.ini \
sockets \
; \
pecl update-channels \
; \
pecl install --onlyreqdeps --nobuild apcu; \
cd "$(pecl config-get temp_dir)/apcu"; \
phpize; \
./configure --enable-apcu; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild igbinary; \
cd "$(pecl config-get temp_dir)/igbinary"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild msgpack; \
cd "$(pecl config-get temp_dir)/msgpack"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
set +e; \
if dpkg --compare-versions ${PHP_VERSION} lt 8.3; then \
pecl install --onlyreqdeps --nobuild imagick; \
cd "$(pecl config-get temp_dir)/imagick"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild sqlsrv; \
cd "$(pecl config-get temp_dir)/sqlsrv"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild pdo_sqlsrv; \
cd "$(pecl config-get temp_dir)/pdo_sqlsrv"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
fi; \
set -e; \
pecl install --onlyreqdeps --nobuild redis; \
cd "$(pecl config-get temp_dir)/redis"; \
phpize; \
./configure --enable-redis-igbinary --enable-redis-json --enable-redis-msgpack --enable-redis-lz4 --with-liblz4=/usr/include; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild memcached; \
cd "$(pecl config-get temp_dir)/memcached"; \
phpize; \
./configure --enable-memcached-igbinary --enable-memcached-json --enable-memcached-session --enable-memcached-sasl --enable-memcached-msgpack; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild xhprof; \
cd "$(pecl config-get temp_dir)/xhprof/extension"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild xdebug; \
cd "$(pecl config-get temp_dir)/xdebug"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild event; \
cd "$(pecl config-get temp_dir)/event"; \
phpize; \
./configure --with-event-core --enable-event-sockets --with-event-openssl --with-event-extra; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild mcrypt; \
cd "$(pecl config-get temp_dir)/mcrypt"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild ast; \
cd "$(pecl config-get temp_dir)/ast"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild pcov; \
cd "$(pecl config-get temp_dir)/pcov"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild swoole; \
cd "$(pecl config-get temp_dir)/swoole"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
pecl install --onlyreqdeps --nobuild uv-beta; \
cd "$(pecl config-get temp_dir)/uv"; \
phpize; \
./configure; \
make && make test && make install || exit 1; \
cd -; \
docker-php-ext-enable --ini-name 0-docker-php-ext-igbinary.ini igbinary; \
docker-php-ext-enable --ini-name 0-docker-php-ext-msgpack.ini msgpack; \
cp /usr/bin/envsubst /usr/local/bin/envsubst; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache $runDeps; \
\
apk del --no-network .build-deps; \
rm -rf /tmp/* ~/.pearrc; \
php --version \
; mv $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
; sed -i "s|^expose_php\s*=\s*\(.*\)|expose_php=Off|g" $PHP_INI_DIR/php.ini \
; sed -i "s|^\(;\)*realpath_cache_size\s*=\s*\(.*\)|realpath_cache_size=\2|g" $PHP_INI_DIR/php.ini \
; sed -i "s|^\(;\)*realpath_cache_ttl\s*=\s*\(.*\)|realpath_cache_ttl=\2|g" $PHP_INI_DIR/php.ini \
; sed -i "s/;emergency_restart_threshold\s*=\s*.*/emergency_restart_threshold = 10/g" $PHP_INI_DIR/../php-fpm.conf \
; sed -i "s/;emergency_restart_interval\s*=\s*.*/emergency_restart_interval = 1m/g" $PHP_INI_DIR/../php-fpm.conf \
; sed -i "s/;process_control_timeout\s*=\s*.*/process_control_timeout = 10s/g" $PHP_INI_DIR/../php-fpm.conf \
;
WORKDIR /var/www/html
CMD ["php-fpm"]