Skip to content

Commit 10f782d

Browse files
committed
Update Dockerfiles to conditionally install dependencies and extensions for PHP 8.4
Signed-off-by: Moritz Mazetti <moritz@matchory.com>
1 parent db403c1 commit 10f782d

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ 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+
3842
# region Install Dependencies
3943
export DEBIAN_FRONTEND=noninteractive
4044
apt-get update
4145
apt-get install \
4246
--yes \
4347
--no-install-recommends \
4448
${PHPIZE_DEPS} \
49+
${php_8_4:+libcurl4-openssl-dev} \
4550
libmemcached-dev \
4651
libsqlite3-dev \
4752
liburing-dev \
@@ -88,7 +93,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
8893
;
8994

9095
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
91-
if php --version | grep -q "PHP 8\.4"; then
96+
if [ "${php_8_4:-}" = "true" ]; then
9297
docker-php-ext-install -j${num_cpu} opcache
9398
fi
9499
# endregion
@@ -110,7 +115,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
110115

111116
# region Install Swoole with extra features
112117
# TODO: Remove this condition when Swoole supports PHP 8.5+
113-
if php --version | grep -q "PHP 8\.4"; then
118+
if [ "${php_8_4:-}" = "true" ]; then
114119
pie install -j${num_cpu} swoole/swoole \
115120
--enable-swoole-sqlite \
116121
--enable-swoole-pgsql \

alpine.Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ 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+
1923
# region Install Dependencies
2024
apk add \
2125
--no-cache \
@@ -37,6 +41,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
3741
--no-cache \
3842
--virtual .build-deps \
3943
${PHPIZE_DEPS} \
44+
${php_8_4:+curl-dev} \
4045
postgresql-dev \
4146
linux-headers \
4247
liburing-dev \
@@ -82,7 +87,7 @@ RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
8287
;
8388

8489
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
85-
if php --version | grep -q "PHP 8\.4"; then
90+
if [ "${php_8_4:-}" = "true" ]; then
8691
docker-php-ext-install -j${num_cpu} opcache
8792
fi
8893
# endregion

0 commit comments

Comments
 (0)