Skip to content

Commit fb0344f

Browse files
committed
Renamed to PHP_COMPILATION_FLAGS as suggested by @mnapoli
This allows full control over the compilation flags for every need
1 parent 871c107 commit fb0344f

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

docker-bake.hcl

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ variable "IMAGE_VERSION_SUFFIX" {
1717
variable "DOCKER_PLATFORM" {
1818
default = "linux/amd64"
1919
}
20-
variable "ENABLE_ZTS" {
20+
variable "PHP_COMPILATION_FLAGS" {
2121
default = ""
2222
}
2323

@@ -27,7 +27,7 @@ target "build-php" {
2727
tags = ["bref/${CPU_PREFIX}build-php-${PHP_VERSION}"]
2828
args = {
2929
"IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}"
30-
"ENABLE_ZTS" = "${ENABLE_ZTS}"
30+
"PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}"
3131
}
3232
platforms = ["${DOCKER_PLATFORM}"]
3333
}
@@ -38,7 +38,7 @@ target "php" {
3838
tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}"]
3939
args = {
4040
"IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}"
41-
"ENABLE_ZTS" = "${ENABLE_ZTS}"
41+
"PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}"
4242
}
4343
contexts = {
4444
"bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php"

php-80/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ RUN curl --location --silent --show-error --fail https://www.php.net/get/php-${V
364364
# --enable-ftp: because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
365365
# --enable-mbstring: because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
366366
# --with-zlib and --with-zlib-dir: See https://stackoverflow.com/a/42978649/245552
367-
ARG ENABLE_ZTS
367+
ARG PHP_COMPILATION_FLAGS
368368
RUN ./buildconf --force
369369
RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
370370
CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
@@ -378,7 +378,6 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
378378
--enable-fpm \
379379
--disable-cgi \
380380
--enable-cli \
381-
${ENABLE_ZTS} \
382381
--disable-phpdbg \
383382
--with-sodium \
384383
--with-readline \
@@ -400,7 +399,9 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
400399
--enable-soap \
401400
--with-xsl=${INSTALL_DIR} \
402401
# necessary for `pecl` to work (to install PHP extensions)
403-
--with-pear
402+
--with-pear \
403+
# extra compilation flags
404+
${PHP_COMPILATION_FLAGS}
404405
RUN make -j $(nproc)
405406
# Run `make install` and override PEAR's PHAR URL because pear.php.net is down
406407
RUN set -xe; \

php-81/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ RUN curl --location --silent --show-error --fail https://www.php.net/get/php-${V
364364
# --enable-ftp: because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
365365
# --enable-mbstring: because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
366366
# --with-zlib and --with-zlib-dir: See https://stackoverflow.com/a/42978649/245552
367-
ARG ENABLE_ZTS
367+
ARG PHP_COMPILATION_FLAGS
368368
RUN ./buildconf --force
369369
RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
370370
CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
@@ -378,7 +378,6 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
378378
--enable-fpm \
379379
--disable-cgi \
380380
--enable-cli \
381-
${ENABLE_ZTS} \
382381
--disable-phpdbg \
383382
--with-sodium \
384383
--with-readline \
@@ -400,7 +399,9 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
400399
--enable-soap \
401400
--with-xsl=${INSTALL_DIR} \
402401
# necessary for `pecl` to work (to install PHP extensions)
403-
--with-pear
402+
--with-pear \
403+
# extra compilation flags
404+
${PHP_COMPILATION_FLAGS}
404405
RUN make -j $(nproc)
405406
# Run `make install` and override PEAR's PHAR URL because pear.php.net is down
406407
RUN set -xe; \

php-82/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ RUN curl --location --silent --show-error --fail https://www.php.net/get/php-${V
364364
# --enable-ftp: because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
365365
# --enable-mbstring: because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
366366
# --with-zlib and --with-zlib-dir: See https://stackoverflow.com/a/42978649/245552
367-
ARG ENABLE_ZTS
367+
ARG PHP_COMPILATION_FLAGS
368368
RUN ./buildconf --force
369369
RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
370370
CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
@@ -378,7 +378,6 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
378378
--enable-fpm \
379379
--disable-cgi \
380380
--enable-cli \
381-
${ENABLE_ZTS} \
382381
--disable-phpdbg \
383382
--with-sodium \
384383
--with-readline \
@@ -400,7 +399,9 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I
400399
--enable-soap \
401400
--with-xsl=${INSTALL_DIR} \
402401
# necessary for `pecl` to work (to install PHP extensions)
403-
--with-pear
402+
--with-pear \
403+
# extra compilation flags
404+
${PHP_COMPILATION_FLAGS}
404405
RUN make -j $(nproc)
405406
# Run `make install` and override PEAR's PHAR URL because pear.php.net is down
406407
RUN set -xe; \

0 commit comments

Comments
 (0)