From cbbf6134e65bfcbd868ad1246d721a90ee8d4e33 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 26 Apr 2024 16:40:44 +0000 Subject: [PATCH] Remove apt lists after 'apt-get update' in docker-contributor/Dockerfile We already do this in all other places. It reduces the size of the image. (Note that the 'rm' command has to be done in the same RUN instruction as 'apt-get update', otherwise the lists will still be stored in the intermediate layers. So some of the RUN instructions had to be merged.) --- docker-contributor/Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docker-contributor/Dockerfile b/docker-contributor/Dockerfile index d311978..d99270c 100644 --- a/docker-contributor/Dockerfile +++ b/docker-contributor/Dockerfile @@ -57,13 +57,13 @@ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && && mv /composer.phar /usr/local/bin/composer # Install all supported PHP versions -RUN add-apt-repository ppa:ondrej/php -y && apt-get update -RUN for VERSION in $PHPSUPPORTED; do \ +RUN add-apt-repository ppa:ondrej/php -y && apt-get update && \ + for VERSION in $PHPSUPPORTED; do \ if [ "${VERSION}" != "8.3" ]; then \ $APTINSTALL php${VERSION}; \ fi; \ - done -RUN PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-"); \ + done && \ + PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-") && \ for PACKAGE in $PACKAGES; do \ PACKAGEALLVERSIONS="" && \ for VERSION in $PHPSUPPORTED; do \ @@ -72,8 +72,9 @@ RUN PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-"); \ fi; \ done; \ $APTINSTALL $PACKAGEALLVERSIONS; \ - done -RUN update-alternatives --set php /usr/bin/php${DEFAULTPHPVERSION} + done && \ + update-alternatives --set php /usr/bin/php${DEFAULTPHPVERSION} && \ + rm -rf /var/lib/apt/lists/* # Set up alternatives for PHP-FPM RUN for VERSION in $PHPSUPPORTED; do \ @@ -88,7 +89,7 @@ COPY ["php-config", "/php-config"] RUN for VERSION in $PHPSUPPORTED; do \ cp -Rf /php-config/* /etc/php/${VERSION}/cli/conf.d; \ cp -Rf /php-config/* /etc/php/${VERSION}/fpm/conf.d; \ - done; \ + done; \ rm -Rf /php-config # Disable Xdebug by default