I still like mlocati/docker-php-extension-installer but I think it would be beneficial if there was official pie functionality that would automatically remove all build dependencies after installing extensions and maybe also remove other bloat. Then, we could just use the official way via pie also in containers (not just locally for dev) and let it handle all extensions.
Things that should be cleaned up after install (could be more):
- Build-only OS packages. To simplify this on Alpine we could use virtual packages and on Debian use diffing over the package list / using
apt-mark + apt-get autoremove.
- The downloaded and extracted extension source and build artifacts (composer caches, attestation artifacts, `vendor/,...)
- Package-manager metadata and caches (
/var/lib/apt/lists/*, /var/cache/apt/*, /var/cache/apk/*).
- Optionally we could strip debug symbols from compiled
.so files to reduce size even more.
Flag naming ideas
pie install xdebug/xdebug \
--cleanup \
--strip-debug-symbols \
I still like
mlocati/docker-php-extension-installerbut I think it would be beneficial if there was officialpiefunctionality that would automatically remove all build dependencies after installing extensions and maybe also remove other bloat. Then, we could just use the official way viapiealso in containers (not just locally for dev) and let it handle all extensions.Things that should be cleaned up after install (could be more):
apt-mark+apt-get autoremove./var/lib/apt/lists/*,/var/cache/apt/*,/var/cache/apk/*)..sofiles to reduce size even more.Flag naming ideas