Skip to content

Commit 1e25f26

Browse files
committed
Simplify PHP 8.4 detection, remove conditional dependency logic in Dockerfiles, add proper error printing for Swoole build errors
Signed-off-by: Moritz Mazetti <moritz@matchory.com>
1 parent c748369 commit 1e25f26

2 files changed

Lines changed: 22 additions & 36 deletions

File tree

Dockerfile

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,14 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
3535
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF
3636
set -eux
3737

38-
if php --version | grep -q "PHP 8\.4"; then
39-
php_8_4=true
40-
fi
41-
4238
# region Install Dependencies
4339
export DEBIAN_FRONTEND=noninteractive
4440
apt-get update
4541
apt-get install \
4642
--yes \
4743
--no-install-recommends \
4844
${PHPIZE_DEPS} \
49-
${php_8_4:+libcurl4-openssl-dev} \
45+
libcurl4-openssl-dev \
5046
libmemcached-dev \
5147
libsqlite3-dev \
5248
liburing-dev \
@@ -93,7 +89,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
9389
;
9490

9591
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
96-
if [ "${php_8_4:-}" = "true" ]; then
92+
if php --version | grep -q "PHP 8\.4"; then
9793
docker-php-ext-install -j${num_cpu} opcache
9894
fi
9995
# endregion
@@ -114,18 +110,15 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
114110
# endregion
115111

116112
# region Install Swoole with extra features
117-
# TODO: Remove this condition when Swoole supports PHP 8.5+
118-
if [ "${php_8_4:-}" = "true" ]; then
119-
pie install -j${num_cpu} swoole/swoole \
120-
--enable-swoole-sqlite \
121-
--enable-swoole-pgsql \
122-
--enable-swoole-curl \
123-
--enable-sockets \
124-
--enable-openssl \
125-
--enable-iouring \
126-
--enable-brotli \
127-
;
128-
fi
113+
pie install -j${num_cpu} swoole/swoole \
114+
--enable-swoole-sqlite \
115+
--enable-swoole-pgsql \
116+
--enable-uring-socket \
117+
--enable-swoole-curl \
118+
--enable-sockets \
119+
--enable-iouring \
120+
--enable-brotli \
121+
|| (cat /tmp/pie_make_output_* 2>&1; exit 2)
129122
# endregion
130123
EOF
131124

alpine.Dockerfile

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
1616
<<EOF
1717
set -eux
1818

19-
if php --version | grep -q "PHP 8\.4"; then
20-
php_8_4=true
21-
fi
22-
2319
# region Install Dependencies
2420
apk add \
2521
--no-cache \
@@ -41,13 +37,13 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
4137
--no-cache \
4238
--virtual .build-deps \
4339
${PHPIZE_DEPS} \
44-
${php_8_4:+curl-dev} \
4540
postgresql-dev \
4641
linux-headers \
4742
liburing-dev \
4843
sqlite-dev \
4944
pcre2-dev \
5045
libuv-dev \
46+
curl-dev \
5147
pcre-dev \
5248
icu-dev \
5349
git \
@@ -87,7 +83,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
8783
;
8884

8985
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
90-
if [ "${php_8_4:-}" = "true" ]; then
86+
if php --version | grep -q "PHP 8\.4"; then
9187
docker-php-ext-install -j${num_cpu} opcache
9288
fi
9389
# endregion
@@ -108,18 +104,15 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
108104
# endregion
109105

110106
# region Install Swoole with extra features
111-
# TODO: Remove this condition when Swoole supports PHP 8.5+
112-
if php --version | grep -q "PHP 8\.4"; then
113-
pie install -j${num_cpu} swoole/swoole \
114-
--enable-swoole-sqlite \
115-
--enable-swoole-pgsql \
116-
--enable-swoole-curl \
117-
--enable-sockets \
118-
--enable-openssl \
119-
--enable-iouring \
120-
--enable-brotli \
121-
;
122-
fi
107+
pie install -j${num_cpu} swoole/swoole \
108+
--enable-swoole-sqlite \
109+
--enable-swoole-pgsql \
110+
--enable-uring-socket \
111+
--enable-swoole-curl \
112+
--enable-sockets \
113+
--enable-iouring \
114+
--enable-brotli \
115+
|| (cat /tmp/pie_make_output_* 2>&1; exit 2)
123116
# endregion
124117

125118
docker-php-source delete

0 commit comments

Comments
 (0)