Skip to content

Commit

Permalink
Remove apt lists after 'apt-get update' in docker-contributor/Dockerfile
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
tom93 committed Jul 9, 2024
1 parent 12a31a1 commit cbbf613
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions docker-contributor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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
Expand Down

0 comments on commit cbbf613

Please sign in to comment.