-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile-fpm
236 lines (234 loc) · 7.55 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
ARG PHP_VERSION=8
FROM php:${PHP_VERSION}-fpm
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; \
apt-get update \
&& LIBAVIF=`apt-cache pkgnames libavif | sort -V | head -1` \
&& LIBEVENTEXTRA=`apt-cache pkgnames libevent-extra | sort -V | head -1` \
&& LIBEVENTOPENSSL=`apt-cache pkgnames libevent-openssl | sort -V | head -1` \
&& LIBEVENTPTHREADS=`apt-cache pkgnames libevent-pthreads | sort -V | head -1` \
&& LIBLZ4=`apt-cache pkgnames liblz4 | sort -V | head -1` \
&& apt-get install --no-install-recommends -y \
git \
imagemagick-common \
${LIBAVIF} \
libc-ares2 \
libcmph0 \
libedit2 \
${LIBEVENTEXTRA} \
${LIBEVENTOPENSSL} \
${LIBEVENTPTHREADS} \
libhashkit2 \
libjpeg62-turbo \
libmemcached11 \
libmemcachedutil2 \
${LIBLZ4} \
libmcrypt4 \
libmsgpackc2 \
libpcre3 \
libpng16-16 \
libsodium23 \
libuv1 \
libxpm4 \
libzip4 \
netcat-traditional \
tzdata \
unzip \
unixodbc \
wget \
zlib1g \
; \
apt-mark manual '.*' > /dev/null; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get install -y --no-install-recommends \
$PHPIZE_DEPS \
build-essential \
gettext-base \
libargon2-dev \
libavif-dev \
libc-ares-dev \
libcmph-dev \
libcurl4-openssl-dev \
libedit-dev \
libevent-dev \
libfreetype-dev \
libicu-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
liblz4-dev \
libmagickcore-dev \
libmagickwand-dev \
libmcrypt-dev \
libmemcached-dev \
libmsgpack-dev \
libonig-dev \
libpcre3-dev \
libpng-dev \
libpng++-dev \
libsodium-dev \
libssl-dev \
libuv1-dev \
libwebp-dev \
libxml2-dev \
libxpm-dev \
libzip-dev \
libbz2-dev \
unixodbc-dev \
zlib1g-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; \
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImport=false; \
rm -rf /tmp/* ~/.pearrc /var/lib/apt/lists/* /var/cache/*; \
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"]