Fail prod image build if PHP is below configurable minimum version

This commit is contained in:
Constantin Graf
2026-11-03 17:40:33 +01:00
committed by Constantin Graf
parent 6e1e947dcf
commit 525ee8d426

View File

@@ -1,4 +1,5 @@
ARG PHP_VERSION=8.3
ARG MIN_PHP_VERSION=8.3.36
ARG FRANKENPHP_VERSION=1.13
ARG COMPOSER_VERSION=2.8
ARG APP_ENV
@@ -35,6 +36,7 @@ ARG USER_ID=1000
ARG GROUP_ID=1000
ARG TZ=UTC
ARG DOCKER_FILES_BASE_PATH
ARG MIN_PHP_VERSION
ENV DEBIAN_FRONTEND=noninteractive \
TERM=xterm-color \
@@ -58,6 +60,8 @@ WORKDIR ${ROOT}
SHELL ["/bin/bash", "-eou", "pipefail", "-c"]
RUN php -r 'if (version_compare(PHP_VERSION, $argv[1], "<")) { fwrite(STDERR, "error: PHP >= {$argv[1]} required, got ".PHP_VERSION.PHP_EOL); exit(1); }' "${MIN_PHP_VERSION}"
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone