Repository navigation
Fix image size (apt caches), fpm graceful stop, stop during startup and Apache modules - #415
Merged
mistraloz merged 3 commits intoOct 9, 2026
Conversation
…ages The extension install scripts disable the docker-clean apt configuration while installing: apt-get update then creates /var/cache/apt/pkgcache.bin and srcpkgcache.bin (~105MB) that apt-get clean no longer knows once docker-clean is restored, so they stayed in the image layer. - The ONBUILD hook no longer runs apt when PHP_EXTENSIONS is empty - The apt binary caches are removed explicitly (ONBUILD hook and fat images)
…artup - fpm variant: STOPSIGNAL SIGQUIT (PHP-FPM graceful stop, running requests are completed) and EXPOSE 9000 - Stop signals ignored by bash were lost while the container was initializing, and the container was killed after the stop timeout: SIGQUIT (fpm) is always ignored by bash, SIGWINCH (apache) by default. The entrypoint and apache2-foreground now trap them. SIGTERM and SIGINT (cli) are not trapped: they already stop bash right away. - Fix the sed commenting the default listen socket in www.conf (single quotes prevented the PHP_VERSION expansion)
brotli, cern_meta, imagemap, md, proxy_hcheck, proxy_uwsgi and socache_redis were listed as available in the README but silently ignored (APACHE_EXTENSION_*) or rejected (APACHE_EXTENSIONS).
mistraloz
force-pushed
the
fix/slim-size-and-fpm-stop
branch
from
October 9, 2026 11:52
4e5fbf2 to
1d18372
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes :
FROMa slim image got a ~110MB layer from the ONBUILD hook, even without anyextension (
PHP_EXTENSIONSempty), and fat images carried the same garbage. The install scripts disable thedocker-cleanapt configuration while installing:apt-get updatethen creates/var/cache/apt/pkgcache.binandsrcpkgcache.bin(~105MB) thatapt-get cleanno longer knows oncedocker-cleanis restored.The hook now exits right away when
PHP_EXTENSIONSis empty, and the caches are removed explicitly.STOPSIGNAL SIGQUIT(PHP-FPM completes the running requests) andEXPOSE 9000.the stop timeout (exit 137 after 10s). bash always ignores
SIGQUIT(fpm) and ignoresSIGWINCH(apache) bydefault. The entrypoint and
apache2-foregroundnow trap them.SIGTERM/SIGINT(cli) are not trapped: theyalready stop bash right away (and trapping them would delay the stop until the end of a long startup command).
brotli,cern_meta,imagemap,md,proxy_hcheck,proxy_uwsgiandsocache_redisareshipped by Ubuntu and documented as available, but were ignored (
APACHE_EXTENSION_*) or rejected(
APACHE_EXTENSIONS).www.confdid nothing (single quotes). No visible effect,zz-docker.confalready overrideslisten./var/cache/apt(PHP 8.4, amd64):FROM thecodingmachine/php:8.4-v5-slim-cli(ONBUILD,PHP_EXTENSIONSempty)8.4-v5-cli(fat)Related issues: #358 (slow shutdown, not reproducible on v5 anymore: 0.1-0.6 s, graceful now), #215 (Apache
SIGWINCH: after the initialization it already works on v5, the remaining case was a stop during theinitialization, fixed here).
Test plan (required)
New tests:
test_gracefulStopandtest_stopDuringStartup(fpm),test_stopDuringStartupandtest_enableApacheModule(apache).(amd64 locally, arm64 by the CI)
Checklist