Skip to content

Commit

Permalink
Improve removal of dev packages
Browse files Browse the repository at this point in the history
 - Due to the PHP libs being at /lib in newer Image versions
   the apt-mark manual wouldn't catch them and remove important libraries.
   This extends the marking of required packages.
  • Loading branch information
martialblog committed Nov 10, 2023
1 parent ef3fab2 commit 8b727d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 6.0/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ RUN set -ex; \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '$3 ~ /^\/lib/ { print "/usr"$3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
Expand Down
7 changes: 7 additions & 0 deletions 6.0/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ RUN set -ex; \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '$3 ~ /^\/lib/ { print "/usr"$3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit 8b727d9

Please sign in to comment.