Skip to content

[FEATURE] Add Brotli and Zstandard. Add <NGINX||APACHE>_MODULES_ENABLE environment variable. - #681

Open
weakbit wants to merge 1 commit into
webdevops:masterfrom
weakbit:zstd-brotli
Open

weakbit wants to merge 1 commit into
webdevops:masterfrom
weakbit:zstd-brotli

Conversation

@weakbit

@weakbit weakbit commented Dec 2, 2026

Copy link
Copy Markdown

What changes

Adds Brotli and Zstandard support to the PHP images and the two web server images, for PHP 8.2 to 8.6, Debian and Alpine.

PHP extensions (php, php-dev, php-nginx, php-apache and their -dev variants)

  • brotli and zstd (installed with PIE from kjdev/brotli and kjdev/zstd). zlib was already there.
  • Runtime libraries libbrotli1/libzstd1 (Debian) and brotli-libs/zstd-libs (Alpine); the -dev packages are removed after the build.

Nginx (php-nginx, php-nginx-dev)

  • Dynamic modules ngx_http_brotli_filter_module, ngx_http_brotli_static_module (google/ngx_brotli) and ngx_http_zstd_filter_module, ngx_http_zstd_static_module (tokers/zstd-nginx-module), built against the nginx version of the image (--with-compat) and loaded from /etc/nginx/modules-enabled/.
  • New variable NGINX_MODULES_ENABLE (brotli, zstd, or the four modules one by one). Default: all four are loaded. Once the variable is set, only the listed modules are loaded; unknown names give a warning.

Apache (php-apache, php-apache-dev)

  • deflate, filter, brotli, asis and zstd modules. mod_zstd (nono303/mod_zstd) is built with apxs against the system libzstd; its license is in /usr/share/doc/mod_zstd/LICENSE.
  • Debian's deflate.conf is removed, so loading the module does not compress anything by itself.
  • New variable APACHE_MODULES_ENABLE (a2enmod on Debian, uncomments the LoadModule line on Alpine).

Compression stays off by default. The modules are only loaded. No image sets gzip on, brotli on, zstd on or an output filter, so the behaviour of existing setups does not change. Users switch it on in their own configuration; docs/customization.md#compression has working examples for Nginx and Apache.

…nd the compression modules of Nginx and Apache
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

# Build brotli and zstd as dynamic modules
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules for the nginx.org package
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules for the nginx.org package
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules for the nginx.org package
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules for the nginx.org package
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
# Build brotli and zstd as dynamic modules for the nginx.org package
&& NGINX_VERSION="$(nginx -v 2>&1 | sed 's|nginx version: nginx/||')" \
&& mkdir -p /usr/src/nginx-modules /etc/nginx/modules \
&& curl -fsSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar -xz -C /usr/src/nginx-modules \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants