php / php/pie

Optionally remove build-only dependencies and bloat after install

Open
#618 2 comments 3 reactions 1 assignee View on GitHub

@asgrim is already working on this.

Since May 19, 2026.

enhancement maintainer investigating
Dominant language
PHP
Stars
2k
Forks
73
Avg merge
3h 37m
Merged PRs (30d)
11

Description

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 \

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.