From 8b727d954f2ad8dd7c85fc6ced0e76970c0e3cc1 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 10 Nov 2023 14:28:49 +0100 Subject: [PATCH] Improve removal of dev packages - 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. --- 6.0/apache/Dockerfile | 7 +++++++ 6.0/fpm/Dockerfile | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/6.0/apache/Dockerfile b/6.0/apache/Dockerfile index 6ca8f38fe..74a93d04c 100644 --- a/6.0/apache/Dockerfile +++ b/6.0/apache/Dockerfile @@ -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/* diff --git a/6.0/fpm/Dockerfile b/6.0/fpm/Dockerfile index c4a900d5c..c97fdb4b6 100644 --- a/6.0/fpm/Dockerfile +++ b/6.0/fpm/Dockerfile @@ -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/*