Skip to content

Commit b724cea

Browse files
committed
Temporarily enable only required PHP extensions for faster builds
1 parent 308f435 commit b724cea

14 files changed

Lines changed: 3855 additions & 29 deletions

.ansible/group_vars/all/mods.yml

Lines changed: 519 additions & 3 deletions
Large diffs are not rendered by default.

Dockerfiles/mods/Dockerfile-5.2

Lines changed: 156 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ FROM devilbox/php-fpm:5.2-base as builder
99
RUN set -eux \
1010
&& DEBIAN_FRONTEND=noninteractive apt-get update \
1111
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
12+
libenchant-dev \
13+
libevent-dev \
14+
libfreetype6-dev \
15+
libjpeg-dev \
16+
libmemcached-dev \
17+
libmysqlclient-dev \
18+
libpng-dev \
19+
libpq-dev \
20+
libvpx-dev \
21+
libwebp-dev \
22+
libxpm-dev \
23+
zlib1g-dev \
1224
# Build tools
1325
autoconf \
1426
bison \
@@ -48,6 +60,117 @@ RUN set -eux \
4860
echo "ffi.enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-ffi.ini; \
4961
fi
5062

63+
# -------------------- Installing PHP Extension: bcmath --------------------
64+
RUN set -eux \
65+
# Installation: Generic
66+
# Type: Built-in extension
67+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) bcmath \
68+
&& true
69+
70+
71+
# -------------------- Installing PHP Extension: enchant --------------------
72+
RUN set -eux \
73+
# Installation: Version specific
74+
# Type: PECL extension
75+
# Custom: Pecl command
76+
&& echo "/usr" | pecl install enchant \
77+
# Enabling
78+
&& docker-php-ext-enable enchant \
79+
&& true
80+
81+
82+
# -------------------- Installing PHP Extension: exif --------------------
83+
RUN set -eux \
84+
# Installation: Generic
85+
# Type: Built-in extension
86+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) exif \
87+
&& true
88+
89+
90+
# -------------------- Installing PHP Extension: gd --------------------
91+
RUN set -eux \
92+
# Version specific pre-command
93+
&& ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libjpeg.* /usr/lib/ && \
94+
ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libpng.* /usr/lib/ && \
95+
ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libXpm.* /usr/lib/ && \
96+
mkdir /usr/include/freetype2/freetype && \
97+
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h \
98+
\
99+
# Installation: Version specific
100+
# Type: Built-in extension
101+
# Custom: configure command
102+
&& docker-php-ext-configure gd --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf \
103+
# Installation
104+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd \
105+
&& true
106+
107+
108+
# -------------------- Installing PHP Extension: igbinary --------------------
109+
RUN set -eux \
110+
# Installation: Version specific
111+
# Type: PECL extension
112+
# Default: Pecl command
113+
&& pecl install igbinary-2.0.7 \
114+
# Enabling
115+
&& docker-php-ext-enable igbinary \
116+
&& true
117+
118+
119+
# -------------------- Installing PHP Extension: msgpack --------------------
120+
RUN set -eux \
121+
# Installation: Version specific
122+
# Type: PECL extension
123+
# Default: Pecl command
124+
&& pecl install msgpack-0.5.7 \
125+
# Enabling
126+
&& docker-php-ext-enable msgpack \
127+
&& true
128+
129+
130+
# -------------------- Installing PHP Extension: memcached --------------------
131+
RUN set -eux \
132+
# Installation: Version specific
133+
# Type: PECL extension
134+
# Default: Pecl command
135+
&& pecl install memcached-2.1.0 \
136+
# Enabling
137+
&& docker-php-ext-enable memcached \
138+
&& true
139+
140+
141+
# -------------------- Installing PHP Extension: mysqli --------------------
142+
RUN set -eux \
143+
# Installation: Version specific
144+
# Type: Built-in extension
145+
# Installation
146+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) mysqli \
147+
&& true
148+
149+
150+
# -------------------- Installing PHP Extension: pgsql --------------------
151+
RUN set -eux \
152+
# Installation: Generic
153+
# Type: Built-in extension
154+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pgsql \
155+
&& true
156+
157+
158+
# -------------------- Installing PHP Extension: redis --------------------
159+
RUN set -eux \
160+
# Generic pre-command
161+
&& if [ -f /usr/include/liblzf/lzf.h ]; then \
162+
ln -s /usr/include/liblzf/lzf.h /usr/include/; \
163+
fi \
164+
\
165+
# Installation: Version specific
166+
# Type: PECL extension
167+
# Default: Pecl command
168+
&& pecl install redis-2.2.7 \
169+
# Enabling
170+
&& docker-php-ext-enable redis \
171+
&& true
172+
173+
51174

52175

53176
# Fix php.ini settings for enabled extensions
@@ -95,6 +218,17 @@ LABEL "org.opencontainers.image.description"="PHP-FPM 5.2-mods"
95218
RUN set -eux \
96219
&& DEBIAN_FRONTEND=noninteractive apt-get update \
97220
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
221+
libenchant1c2a \
222+
libevent-2.0-5 \
223+
libfreetype6 \
224+
libjpeg62-turbo \
225+
libmemcachedutil2 \
226+
libmysqlclient18 \
227+
libpng12-0 \
228+
libpq5 \
229+
libvpx1 \
230+
libwebp5 \
231+
libxpm4 \
98232
ca-certificates \
99233
&& rm -rf /var/lib/apt/lists/* \
100234
\
@@ -134,8 +268,28 @@ RUN set -eux \
134268
&& if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \
135269
&& rm -f /usr/local/etc/php/php.ini \
136270
\
137-
&& php -m | grep -oiE '^hash$' \
138-
&& php-fpm -m | grep -oiE '^hash$' \
271+
&& php -m | grep -oiE '^bcmath$' \
272+
&& php-fpm -m | grep -oiE '^bcmath$' \
273+
&& php -m | grep -oiE '^enchant$' \
274+
&& php-fpm -m | grep -oiE '^enchant$' \
275+
&& php -m | grep -oiE '^mbstring$' \
276+
&& php-fpm -m | grep -oiE '^mbstring$' \
277+
&& php -m | grep -oiE '^exif$' \
278+
&& php-fpm -m | grep -oiE '^exif$' \
279+
&& php -m | grep -oiE '^gd$' \
280+
&& php-fpm -m | grep -oiE '^gd$' \
281+
&& php -m | grep -oiE '^igbinary$' \
282+
&& php-fpm -m | grep -oiE '^igbinary$' \
283+
&& php -m | grep -oiE '^msgpack$' \
284+
&& php-fpm -m | grep -oiE '^msgpack$' \
285+
&& php -m | grep -oiE '^memcached$' \
286+
&& php-fpm -m | grep -oiE '^memcached$' \
287+
&& php -m | grep -oiE '^mysqli$' \
288+
&& php-fpm -m | grep -oiE '^mysqli$' \
289+
&& php -m | grep -oiE '^pgsql$' \
290+
&& php-fpm -m | grep -oiE '^pgsql$' \
291+
&& php -m | grep -oiE '^redis$' \
292+
&& php-fpm -m | grep -oiE '^redis$' \
139293
&& true
140294

141295

Dockerfiles/mods/Dockerfile-5.3

Lines changed: 181 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ FROM devilbox/php-fpm:5.3-base as builder
99
RUN set -eux \
1010
&& DEBIAN_FRONTEND=noninteractive apt-get update \
1111
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
12+
libenchant-dev \
13+
libevent-dev \
14+
libfreetype6-dev \
15+
libjpeg-dev \
16+
libmemcached-dev \
17+
libmysqlclient-dev \
18+
libpng-dev \
19+
libpq-dev \
20+
libsasl2-dev \
21+
libssl-dev \
22+
libvpx-dev \
23+
libwebp-dev \
24+
libxpm-dev \
25+
zlib1g-dev \
1226
# Build tools
1327
autoconf \
1428
bison \
@@ -48,6 +62,136 @@ RUN set -eux \
4862
echo "ffi.enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-ffi.ini; \
4963
fi
5064

65+
# -------------------- Installing PHP Extension: bcmath --------------------
66+
RUN set -eux \
67+
# Installation: Generic
68+
# Type: Built-in extension
69+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) bcmath \
70+
&& true
71+
72+
73+
# -------------------- Installing PHP Extension: enchant --------------------
74+
RUN set -eux \
75+
# Installation: Generic
76+
# Type: Built-in extension
77+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) enchant \
78+
&& true
79+
80+
81+
# -------------------- Installing PHP Extension: exif --------------------
82+
RUN set -eux \
83+
# Installation: Generic
84+
# Type: Built-in extension
85+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) exif \
86+
&& true
87+
88+
89+
# -------------------- Installing PHP Extension: gd --------------------
90+
RUN set -eux \
91+
# Version specific pre-command
92+
&& ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libjpeg.* /usr/lib/ && \
93+
ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libpng.* /usr/lib/ && \
94+
ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libXpm.* /usr/lib/ && \
95+
mkdir /usr/include/freetype2/freetype && \
96+
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h \
97+
\
98+
# Installation: Version specific
99+
# Type: Built-in extension
100+
# Custom: configure command
101+
&& docker-php-ext-configure gd --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf \
102+
# Installation
103+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd \
104+
&& true
105+
106+
107+
# -------------------- Installing PHP Extension: igbinary --------------------
108+
RUN set -eux \
109+
# Installation: Version specific
110+
# Type: PECL extension
111+
# Default: Pecl command
112+
&& pecl install igbinary-2.0.8 \
113+
# Enabling
114+
&& docker-php-ext-enable igbinary \
115+
&& true
116+
117+
118+
# -------------------- Installing PHP Extension: msgpack --------------------
119+
RUN set -eux \
120+
# Installation: Version specific
121+
# Type: PECL extension
122+
# Default: Pecl command
123+
&& pecl install msgpack-0.5.7 \
124+
# Enabling
125+
&& docker-php-ext-enable msgpack \
126+
&& true
127+
128+
129+
# -------------------- Installing PHP Extension: memcached --------------------
130+
RUN set -eux \
131+
# Installation: Version specific
132+
# Type: PECL extension
133+
# Default: Pecl command
134+
&& pecl install memcached-2.2.0 \
135+
# Enabling
136+
&& docker-php-ext-enable memcached \
137+
&& true
138+
139+
140+
# -------------------- Installing PHP Extension: mongodb --------------------
141+
RUN set -eux \
142+
# Installation: Version specific
143+
# Type: PECL extension
144+
# Default: Pecl command
145+
&& pecl install mongodb-0.6.3 \
146+
# Enabling
147+
&& docker-php-ext-enable mongodb \
148+
&& true
149+
150+
151+
# -------------------- Installing PHP Extension: mysqli --------------------
152+
RUN set -eux \
153+
# Installation: Version specific
154+
# Type: Built-in extension
155+
# Installation
156+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) mysqli \
157+
&& true
158+
159+
160+
# -------------------- Installing PHP Extension: pgsql --------------------
161+
RUN set -eux \
162+
# Installation: Generic
163+
# Type: Built-in extension
164+
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pgsql \
165+
&& true
166+
167+
168+
# -------------------- Installing PHP Extension: apcu --------------------
169+
RUN set -eux \
170+
# Installation: Version specific
171+
# Type: PECL extension
172+
# Default: Pecl command
173+
&& pecl install apcu-4.0.11 \
174+
# Enabling
175+
&& docker-php-ext-enable apcu \
176+
&& true
177+
178+
179+
# -------------------- Installing PHP Extension: redis --------------------
180+
RUN set -eux \
181+
# Generic pre-command
182+
&& if [ -f /usr/include/liblzf/lzf.h ]; then \
183+
ln -s /usr/include/liblzf/lzf.h /usr/include/; \
184+
fi \
185+
\
186+
# Installation: Version specific
187+
# Type: PECL extension
188+
# Default: Pecl command
189+
&& pecl install redis-4.3.0 \
190+
# Enabling
191+
&& docker-php-ext-enable redis \
192+
&& true
193+
194+
51195

52196

53197
# Fix php.ini settings for enabled extensions
@@ -95,6 +239,17 @@ LABEL "org.opencontainers.image.description"="PHP-FPM 5.3-mods"
95239
RUN set -eux \
96240
&& DEBIAN_FRONTEND=noninteractive apt-get update \
97241
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
242+
libenchant1c2a \
243+
libevent-2.0-5 \
244+
libfreetype6 \
245+
libjpeg62-turbo \
246+
libmemcachedutil2 \
247+
libmysqlclient18 \
248+
libpng12-0 \
249+
libpq5 \
250+
libvpx1 \
251+
libwebp5 \
252+
libxpm4 \
98253
ca-certificates \
99254
&& rm -rf /var/lib/apt/lists/* \
100255
\
@@ -134,8 +289,32 @@ RUN set -eux \
134289
&& if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \
135290
&& rm -f /usr/local/etc/php/php.ini \
136291
\
137-
&& php -m | grep -oiE '^hash$' \
138-
&& php-fpm -m | grep -oiE '^hash$' \
292+
&& php -m | grep -oiE '^bcmath$' \
293+
&& php-fpm -m | grep -oiE '^bcmath$' \
294+
&& php -m | grep -oiE '^enchant$' \
295+
&& php-fpm -m | grep -oiE '^enchant$' \
296+
&& php -m | grep -oiE '^mbstring$' \
297+
&& php-fpm -m | grep -oiE '^mbstring$' \
298+
&& php -m | grep -oiE '^exif$' \
299+
&& php-fpm -m | grep -oiE '^exif$' \
300+
&& php -m | grep -oiE '^gd$' \
301+
&& php-fpm -m | grep -oiE '^gd$' \
302+
&& php -m | grep -oiE '^igbinary$' \
303+
&& php-fpm -m | grep -oiE '^igbinary$' \
304+
&& php -m | grep -oiE '^msgpack$' \
305+
&& php-fpm -m | grep -oiE '^msgpack$' \
306+
&& php -m | grep -oiE '^memcached$' \
307+
&& php-fpm -m | grep -oiE '^memcached$' \
308+
&& php -m | grep -oiE '^mongodb$' \
309+
&& php-fpm -m | grep -oiE '^mongodb$' \
310+
&& php -m | grep -oiE '^mysqli$' \
311+
&& php-fpm -m | grep -oiE '^mysqli$' \
312+
&& php -m | grep -oiE '^pgsql$' \
313+
&& php-fpm -m | grep -oiE '^pgsql$' \
314+
&& php -m | grep -oiE '^apcu$' \
315+
&& php-fpm -m | grep -oiE '^apcu$' \
316+
&& php -m | grep -oiE '^redis$' \
317+
&& php-fpm -m | grep -oiE '^redis$' \
139318
&& true
140319

141320

0 commit comments

Comments
 (0)