From ced4bc0f5bf6a9dd9c2b965e3c750812fa77d414 Mon Sep 17 00:00:00 2001 From: Chingis S Date: Sun, 15 Nov 2026 01:30:30 +0300 Subject: [PATCH] Record the Apache package version of the -apache images The -apache images install Alpine's apache2 package, which the PHP base images do not contain, so base image digest updates do not follow Apache releases. apache-packages.mk now records the minimum apache2 version for each PHP version. The image updater bumps it when Alpine publishes a newer package, and that commit rebuilds the images. Builds require at least the recorded version, so an outdated package mirror fails the build instead of shipping an older Apache. Builds of a PHP version without a recorded version fail before starting. --- 8/Dockerfile | 9 ++++++++- 8/Makefile | 12 ++++++++---- README.md | 1 + apache-packages.mk | 8 ++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 apache-packages.mk diff --git a/8/Dockerfile b/8/Dockerfile index 38bc7d38..73306661 100644 --- a/8/Dockerfile +++ b/8/Dockerfile @@ -455,10 +455,17 @@ CMD ["sudo", "-E", "php-fpm"] # one image runs an application without a separate web server service. FROM php AS apache +# The minimum Apache package version from apache-packages.mk. Its updates are +# what rebuild this variant when Alpine ships a new Apache release. +ARG APACHE_PACKAGE_VERSION + USER root RUN set -xe; \ - apk add --update --no-cache apache2 apache2-proxy; \ + test -n "${APACHE_PACKAGE_VERSION}"; \ + apk add --update --no-cache \ + "apache2>=${APACHE_PACKAGE_VERSION}" \ + "apache2-proxy>=${APACHE_PACKAGE_VERSION}"; \ # The image's own configuration replaces Alpine's defaults. \ rm -f /etc/apache2/conf.d/*.conf; \ touch /etc/apache2/vhost.conf; \ diff --git a/8/Makefile b/8/Makefile index 9adefecb..1fb3e240 100644 --- a/8/Makefile +++ b/8/Makefile @@ -34,6 +34,10 @@ ifneq ($(PHP_WEB),) $(error PHP_WEB has no development variant) endif TARGET := $(PHP_WEB) + # Fail before building when the PHP version has no reviewed Apache package version. + include ../apache-packages.mk + APACHE_PACKAGE_VERSION := $(or $(APACHE_PACKAGE_VERSION_$(PHP_VER_MINOR)),$(error No Apache package version for PHP $(PHP_VER_MINOR); update apache-packages.mk)) + APACHE_BUILD_ARGS = --build-arg APACHE_PACKAGE_VERSION=$(APACHE_PACKAGE_VERSION) else TARGET := php endif @@ -76,7 +80,7 @@ build: --build-arg WODBY_USER_ID=$(WODBY_USER_ID) \ --build-arg WODBY_GROUP_ID=$(WODBY_GROUP_ID) \ --target $(TARGET) \ - $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) \ + $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) $(APACHE_BUILD_ARGS) \ ./ build-debug: @@ -86,7 +90,7 @@ build-debug: --build-arg WODBY_USER_ID=$(WODBY_USER_ID) \ --build-arg WODBY_GROUP_ID=$(WODBY_GROUP_ID) \ --target $(TARGET) \ - $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) \ + $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) $(APACHE_BUILD_ARGS) \ --no-cache --progress=plain ./ 2>&1 | tee build.log buildx-build: @@ -96,7 +100,7 @@ buildx-build: --build-arg WODBY_USER_ID=$(WODBY_USER_ID) \ --build-arg WODBY_GROUP_ID=$(WODBY_GROUP_ID) \ --target $(TARGET) \ - $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) \ + $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) $(APACHE_BUILD_ARGS) \ --load \ ./ @@ -107,7 +111,7 @@ buildx-push: --build-arg WODBY_USER_ID=$(WODBY_USER_ID) \ --build-arg WODBY_GROUP_ID=$(WODBY_GROUP_ID) \ --target $(TARGET) \ - $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) \ + $(PROXY_BUILD_ARGS) $(PIE_BUILD_SECRET) $(APACHE_BUILD_ARGS) \ ./ buildx-imagetools-create: diff --git a/README.md b/README.md index 4e20279a..b706ac64 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ container, so an application is served without a separate web server container: - `/.healthz` answers `204`, and the `check-ready` action checks both Apache and PHP-FPM - Commands other than the default, such as cron jobs or queue workers, run without Apache - There are no `-dev` variants +- Apache comes from Alpine Linux's `apache2` package. The images are rebuilt when Alpine publishes a newer version | Variable | Default value | Description | |----------------------------------------|---------------------------------------------------------|--------------------------------------------------------------------------------| diff --git a/apache-packages.mk b/apache-packages.mk new file mode 100644 index 00000000..ec3b369e --- /dev/null +++ b/apache-packages.mk @@ -0,0 +1,8 @@ +# Minimum Alpine apache2 package version for the -apache variant of each PHP +# version. Updated by wodby/images when Alpine publishes a newer package, so a +# changed line rebuilds the images with that Apache release. Builds install the +# newest available package and fail if the repository offers an older one. +APACHE_PACKAGE_VERSION_8.5 := 2.4.71-r0 +APACHE_PACKAGE_VERSION_8.4 := 2.4.71-r0 +APACHE_PACKAGE_VERSION_8.3 := 2.4.71-r0 +APACHE_PACKAGE_VERSION_8.2 := 2.4.71-r0