From 842ade2a138b1fdf7d0cacd0afbf6a75332fc8f4 Mon Sep 17 00:00:00 2001 From: Eric de Ruiter Date: Thu, 29 Jun 2023 15:59:36 +0200 Subject: [PATCH] Fix for debian 12 issue (#416) that caused libraries for extensions to be uninstalled --- CHANGELOG.md | 1 + Dockerfile-debian.template | 7 +++++-- apache/Dockerfile | 6 ++++-- fpm/Dockerfile | 6 ++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90a6660f..ee59ebc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add `TZ` env var to change PHP `date.timezone` (#133) - Update to PHP 8.2 (#411) - Add back a `/sessions` volume for sessions persistence (#399) +- Fix for debian 12 issue (#416) that caused libraries for extensions to be uninstalled ## [5.2.1] - 2023-02-08 diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index bafda382..5c47cc58 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -27,8 +27,10 @@ RUN set -ex; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + extdir="$(php -r 'echo ini_get("extension_dir");')"; \ + ldd "$extdir"/*.so \ | awk '/=>/ { print $3 }' \ + | awk '{print $1} {system("realpath " $1)}' \ | sort -u \ | xargs -r dpkg-query -S \ | cut -d: -f1 \ @@ -36,7 +38,8 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/*; \ + ldd "$extdir"/*.so | grep -qzv "=> not found"; # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php diff --git a/apache/Dockerfile b/apache/Dockerfile index f51e02a6..a0ee6d81 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -27,7 +27,8 @@ RUN set -ex; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + extdir="$(php -r 'echo ini_get("extension_dir");')"; \ + ldd "$extdir"/*.so \ | awk '/=>/ { print $3 }' \ | sort -u \ | xargs -r dpkg-query -S \ @@ -36,7 +37,8 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/*; \ + ldd "$extdir"/*.so | grep -qzv "=> not found"; # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 9047cd7c..2142893f 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -27,7 +27,8 @@ RUN set -ex; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + extdir="$(php -r 'echo ini_get("extension_dir");')"; \ + ldd "$extdir"/*.so \ | awk '/=>/ { print $3 }' \ | sort -u \ | xargs -r dpkg-query -S \ @@ -36,7 +37,8 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/*; \ + ldd "$extdir"/*.so | grep -qzv "=> not found"; # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php