Skip to content

Commit d1da7b7

Browse files
tom93vmcj
authored andcommitted
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.)
1 parent d60e5e5 commit d1da7b7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docker-contributor/Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&
5757
&& mv /composer.phar /usr/local/bin/composer
5858

5959
# Install all supported PHP versions
60-
RUN add-apt-repository ppa:ondrej/php -y && apt-get update
61-
RUN for VERSION in $PHPSUPPORTED; do \
60+
RUN add-apt-repository ppa:ondrej/php -y && apt-get update && \
61+
for VERSION in $PHPSUPPORTED; do \
6262
if [ "${VERSION}" != "8.3" ]; then \
6363
$APTINSTALL php${VERSION}; \
6464
fi; \
65-
done
66-
RUN PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-"); \
65+
done && \
66+
PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-") && \
6767
for PACKAGE in $PACKAGES; do \
6868
PACKAGEALLVERSIONS="" && \
6969
for VERSION in $PHPSUPPORTED; do \
@@ -72,8 +72,9 @@ RUN PACKAGES=$(dpkg-query -f '${binary:Package}\n' -W|grep "^php.*-"); \
7272
fi; \
7373
done; \
7474
$APTINSTALL $PACKAGEALLVERSIONS; \
75-
done
76-
RUN update-alternatives --set php /usr/bin/php${DEFAULTPHPVERSION}
75+
done && \
76+
update-alternatives --set php /usr/bin/php${DEFAULTPHPVERSION} && \
77+
rm -rf /var/lib/apt/lists/*
7778

7879
# Set up alternatives for PHP-FPM
7980
RUN for VERSION in $PHPSUPPORTED; do \
@@ -88,7 +89,7 @@ COPY ["php-config", "/php-config"]
8889
RUN for VERSION in $PHPSUPPORTED; do \
8990
cp -Rf /php-config/* /etc/php/${VERSION}/cli/conf.d; \
9091
cp -Rf /php-config/* /etc/php/${VERSION}/fpm/conf.d; \
91-
done; \
92+
done; \
9293
rm -Rf /php-config
9394

9495
# Disable Xdebug by default

0 commit comments

Comments
 (0)