From b418908d2f1260af1b4e26532991be0a563dadd5 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 3 Jan 2018 10:55:13 -0800 Subject: [PATCH] Update Debian "libs preserving" code to match Alpine (using "ldd" and "apt-mark" to auto-determine necessary dependencies) --- 5.6/jessie/apache/Dockerfile | 68 +++++++++++++++++++++------------- 5.6/jessie/cli/Dockerfile | 68 +++++++++++++++++++++------------- 5.6/jessie/fpm/Dockerfile | 68 +++++++++++++++++++++------------- 5.6/jessie/zts/Dockerfile | 68 +++++++++++++++++++++------------- 7.0/jessie/apache/Dockerfile | 68 +++++++++++++++++++++------------- 7.0/jessie/cli/Dockerfile | 68 +++++++++++++++++++++------------- 7.0/jessie/fpm/Dockerfile | 68 +++++++++++++++++++++------------- 7.0/jessie/zts/Dockerfile | 68 +++++++++++++++++++++------------- 7.1/jessie/apache/Dockerfile | 68 +++++++++++++++++++++------------- 7.1/jessie/cli/Dockerfile | 68 +++++++++++++++++++++------------- 7.1/jessie/fpm/Dockerfile | 68 +++++++++++++++++++++------------- 7.1/jessie/zts/Dockerfile | 68 +++++++++++++++++++++------------- 7.2/stretch/apache/Dockerfile | 69 +++++++++++++++++++++-------------- 7.2/stretch/cli/Dockerfile | 69 +++++++++++++++++++++-------------- 7.2/stretch/fpm/Dockerfile | 69 +++++++++++++++++++++-------------- 7.2/stretch/zts/Dockerfile | 69 +++++++++++++++++++++-------------- Dockerfile-debian.template | 69 +++++++++++++++++++++-------------- 17 files changed, 714 insertions(+), 447 deletions(-) diff --git a/5.6/jessie/apache/Dockerfile b/5.6/jessie/apache/Dockerfile index 1162334f..7b53c4b2 100644 --- a/5.6/jessie/apache/Dockerfile +++ b/5.6/jessie/apache/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -158,30 +155,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -205,19 +207,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/5.6/jessie/cli/Dockerfile b/5.6/jessie/cli/Dockerfile index e015a3d3..8cfdebad 100644 --- a/5.6/jessie/cli/Dockerfile +++ b/5.6/jessie/cli/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -99,30 +96,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -146,19 +148,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/5.6/jessie/fpm/Dockerfile b/5.6/jessie/fpm/Dockerfile index 22c4cd53..44a11713 100644 --- a/5.6/jessie/fpm/Dockerfile +++ b/5.6/jessie/fpm/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/5.6/jessie/zts/Dockerfile b/5.6/jessie/zts/Dockerfile index 688a6dbe..2125bd0c 100644 --- a/5.6/jessie/zts/Dockerfile +++ b/5.6/jessie/zts/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.0/jessie/apache/Dockerfile b/7.0/jessie/apache/Dockerfile index 555dc1ce..b7e46b08 100644 --- a/7.0/jessie/apache/Dockerfile +++ b/7.0/jessie/apache/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -158,30 +155,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -205,19 +207,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.0/jessie/cli/Dockerfile b/7.0/jessie/cli/Dockerfile index 7c7e9f0c..581be458 100644 --- a/7.0/jessie/cli/Dockerfile +++ b/7.0/jessie/cli/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -99,30 +96,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -146,19 +148,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.0/jessie/fpm/Dockerfile b/7.0/jessie/fpm/Dockerfile index c452ebe5..a030d85b 100644 --- a/7.0/jessie/fpm/Dockerfile +++ b/7.0/jessie/fpm/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.0/jessie/zts/Dockerfile b/7.0/jessie/zts/Dockerfile index a1b7f717..a342578c 100644 --- a/7.0/jessie/zts/Dockerfile +++ b/7.0/jessie/zts/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.1/jessie/apache/Dockerfile b/7.1/jessie/apache/Dockerfile index 11a6fcb0..b172bfb8 100644 --- a/7.1/jessie/apache/Dockerfile +++ b/7.1/jessie/apache/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -158,30 +155,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -205,19 +207,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.1/jessie/cli/Dockerfile b/7.1/jessie/cli/Dockerfile index cf946d34..a9bec5b5 100644 --- a/7.1/jessie/cli/Dockerfile +++ b/7.1/jessie/cli/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -99,30 +96,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -146,19 +148,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.1/jessie/fpm/Dockerfile b/7.1/jessie/fpm/Dockerfile index b423e622..fd0dcb9b 100644 --- a/7.1/jessie/fpm/Dockerfile +++ b/7.1/jessie/fpm/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.1/jessie/zts/Dockerfile b/7.1/jessie/zts/Dockerfile index cf927718..562cc831 100644 --- a/7.1/jessie/zts/Dockerfile +++ b/7.1/jessie/zts/Dockerfile @@ -30,9 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,30 +97,35 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libcurl4-openssl-dev \ libedit-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -147,19 +149,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.2/stretch/apache/Dockerfile b/7.2/stretch/apache/Dockerfile index 4213667f..0c2c836c 100644 --- a/7.2/stretch/apache/Dockerfile +++ b/7.2/stretch/apache/Dockerfile @@ -30,10 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libargon2-0 \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -159,9 +155,11 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libargon2-0-dev \ libcurl4-openssl-dev \ libedit-dev \ @@ -169,21 +167,24 @@ RUN set -xe \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -209,19 +210,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.2/stretch/cli/Dockerfile b/7.2/stretch/cli/Dockerfile index cab3279f..569292d6 100644 --- a/7.2/stretch/cli/Dockerfile +++ b/7.2/stretch/cli/Dockerfile @@ -30,10 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libargon2-0 \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -100,9 +96,11 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libargon2-0-dev \ libcurl4-openssl-dev \ libedit-dev \ @@ -110,21 +108,24 @@ RUN set -xe \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -150,19 +151,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.2/stretch/fpm/Dockerfile b/7.2/stretch/fpm/Dockerfile index 20de860d..8f573091 100644 --- a/7.2/stretch/fpm/Dockerfile +++ b/7.2/stretch/fpm/Dockerfile @@ -30,10 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libargon2-0 \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -101,9 +97,11 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libargon2-0-dev \ libcurl4-openssl-dev \ libedit-dev \ @@ -111,21 +109,24 @@ RUN set -xe \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -151,19 +152,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/7.2/stretch/zts/Dockerfile b/7.2/stretch/zts/Dockerfile index d932c31e..358a9705 100644 --- a/7.2/stretch/zts/Dockerfile +++ b/7.2/stretch/zts/Dockerfile @@ -30,10 +30,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libargon2-0 \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -101,9 +97,11 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libargon2-0-dev \ libcurl4-openssl-dev \ libedit-dev \ @@ -111,21 +109,24 @@ RUN set -xe \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -151,19 +152,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 65963806..4ccd593a 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -24,10 +24,6 @@ RUN apt-get update && apt-get install -y \ $PHPIZE_DEPS \ ca-certificates \ curl \ - libargon2-0 \ - libedit2 \ - libsqlite3-0 \ - libxml2 \ xz-utils \ --no-install-recommends && rm -r /var/lib/apt/lists/* @@ -94,9 +90,11 @@ RUN set -xe; \ COPY docker-php-source /usr/local/bin/ -RUN set -xe \ - && buildDeps=" \ - $PHP_EXTRA_BUILD_DEPS \ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libargon2-0-dev \ libcurl4-openssl-dev \ libedit-dev \ @@ -104,21 +102,24 @@ RUN set -xe \ libssl-dev \ libxml2-dev \ zlib1g-dev \ - " \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ \ - && export CFLAGS="$PHP_CFLAGS" \ + export \ + CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ - && docker-php-source extract \ - && cd /usr/src/php \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ # https://bugs.php.net/bug.php?id=74125 - && if [ ! -d /usr/include/curl ]; then \ + if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi \ - && ./configure \ + fi; \ + ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ @@ -144,19 +145,33 @@ RUN set -xe \ $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - $PHP_EXTRA_CONFIGURE_ARGS \ - && make -j "$(nproc)" \ - && make install \ - && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ - && make clean \ - && cd / \ - && docker-php-source delete \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + docker-php-source delete; \ \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + php --version; \ \ # https://github.com/docker-library/php/issues/443 - && pecl update-channels \ - && rm -rf /tmp/pear ~/.pearrc + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/