Remove buildDeps after php extensions have been installed

This commit is contained in:
J0WI 2018-04-29 23:10:45 +02:00
parent 380351ca47
commit 88dd9768ce
2 changed files with 28 additions and 0 deletions

View File

@ -4,6 +4,8 @@ LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
RUN set -ex; \ RUN set -ex; \
apt-get update; \ apt-get update; \
\ \
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
libfreetype6-dev \ libfreetype6-dev \
libicu-dev \ libicu-dev \
@ -30,6 +32,18 @@ RUN set -ex; \
zip \ zip \
; \ ; \
\ \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $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/* rm -rf /var/lib/apt/lists/*
# enable mod_rewrite # enable mod_rewrite

View File

@ -4,6 +4,8 @@ LABEL maintainer="Thomas Bruederli <thomas@roundcube.net>"
RUN set -ex; \ RUN set -ex; \
apt-get update; \ apt-get update; \
\ \
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
libfreetype6-dev \ libfreetype6-dev \
libicu-dev \ libicu-dev \
@ -30,6 +32,18 @@ RUN set -ex; \
zip \ zip \
; \ ; \
\ \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $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/* rm -rf /var/lib/apt/lists/*
# expose these volumes # expose these volumes