From 3241bd66860cd829fb83612e534e50043eaf23fd Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 23 Nov 2026 15:22:15 +0100 Subject: [PATCH] Don't ship the extensions twice in the runtime image The runtime stage copied /usr/local/lib/php/extensions with PHP's own extension directory inside it (no-debug-non-zts-*), which holds the same .so files: about 1.8 MB. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7f42f7e8..69465cf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -223,7 +223,8 @@ RUN set -xe; \ COPY --link --from=build-environment /usr/local/bin/php /usr/local/bin/php COPY --link --from=build-environment /usr/local/sbin/php-fpm /usr/local/sbin/php-fpm -COPY --link --from=build-environment /usr/local/lib/php/extensions /usr/local/lib/php/extensions +# Only the .so files: the build stage also keeps them in PHP's own extension directory (for pecl and phpize) +COPY --link --from=build-environment /usr/local/lib/php/extensions/*.so /usr/local/lib/php/extensions/ COPY --link src/php.ini /etc/php/conf.d/50-bref.ini # Before PHP 8.5, opcache is a shared extension