From 796b04b4572be9544889a9b601e36203c75cedac Mon Sep 17 00:00:00 2001 From: cytopia Date: Thu, 8 Dec 2022 08:45:50 +0100 Subject: [PATCH] Strip debugging information to reduce file sizes --- .ansible/DOCKERFILES/Dockerfile-slim.j2 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-5.2 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-5.3 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-5.4 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-5.5 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-5.6 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-7.0 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-7.1 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-7.2 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-7.3 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-7.4 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-8.0 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-8.1 | 28 ++++++++++++++++++++++++- Dockerfiles/slim/Dockerfile-8.2 | 28 ++++++++++++++++++++++++- 14 files changed, 378 insertions(+), 14 deletions(-) diff --git a/.ansible/DOCKERFILES/Dockerfile-slim.j2 b/.ansible/DOCKERFILES/Dockerfile-slim.j2 index 18d58df..2258717 100644 --- a/.ansible/DOCKERFILES/Dockerfile-slim.j2 +++ b/.ansible/DOCKERFILES/Dockerfile-slim.j2 @@ -163,6 +163,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -180,7 +206,7 @@ FROM devilbox/php-fpm:{{ php_version }}-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-5.2 b/Dockerfiles/slim/Dockerfile-5.2 index 46a759b..aa7107a 100644 --- a/Dockerfiles/slim/Dockerfile-5.2 +++ b/Dockerfiles/slim/Dockerfile-5.2 @@ -209,6 +209,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -226,7 +252,7 @@ FROM devilbox/php-fpm:5.2-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-5.3 b/Dockerfiles/slim/Dockerfile-5.3 index 31c4b8d..3b612cd 100644 --- a/Dockerfiles/slim/Dockerfile-5.3 +++ b/Dockerfiles/slim/Dockerfile-5.3 @@ -209,6 +209,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -226,7 +252,7 @@ FROM devilbox/php-fpm:5.3-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-5.4 b/Dockerfiles/slim/Dockerfile-5.4 index 4232c58..16da821 100644 --- a/Dockerfiles/slim/Dockerfile-5.4 +++ b/Dockerfiles/slim/Dockerfile-5.4 @@ -209,6 +209,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -226,7 +252,7 @@ FROM devilbox/php-fpm:5.4-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-5.5 b/Dockerfiles/slim/Dockerfile-5.5 index d11cdf2..ea5f81f 100644 --- a/Dockerfiles/slim/Dockerfile-5.5 +++ b/Dockerfiles/slim/Dockerfile-5.5 @@ -209,6 +209,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -226,7 +252,7 @@ FROM devilbox/php-fpm:5.5-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-5.6 b/Dockerfiles/slim/Dockerfile-5.6 index 310e3eb..6e806b0 100644 --- a/Dockerfiles/slim/Dockerfile-5.6 +++ b/Dockerfiles/slim/Dockerfile-5.6 @@ -213,6 +213,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -230,7 +256,7 @@ FROM devilbox/php-fpm:5.6-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-7.0 b/Dockerfiles/slim/Dockerfile-7.0 index 6f269b7..f393205 100644 --- a/Dockerfiles/slim/Dockerfile-7.0 +++ b/Dockerfiles/slim/Dockerfile-7.0 @@ -213,6 +213,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -230,7 +256,7 @@ FROM devilbox/php-fpm:7.0-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-7.1 b/Dockerfiles/slim/Dockerfile-7.1 index 5e85e85..687341f 100644 --- a/Dockerfiles/slim/Dockerfile-7.1 +++ b/Dockerfiles/slim/Dockerfile-7.1 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:7.1-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-7.2 b/Dockerfiles/slim/Dockerfile-7.2 index 9020b33..6e0b382 100644 --- a/Dockerfiles/slim/Dockerfile-7.2 +++ b/Dockerfiles/slim/Dockerfile-7.2 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:7.2-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-7.3 b/Dockerfiles/slim/Dockerfile-7.3 index a844a4d..697a3c8 100644 --- a/Dockerfiles/slim/Dockerfile-7.3 +++ b/Dockerfiles/slim/Dockerfile-7.3 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:7.3-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-7.4 b/Dockerfiles/slim/Dockerfile-7.4 index abf916c..6954dab 100644 --- a/Dockerfiles/slim/Dockerfile-7.4 +++ b/Dockerfiles/slim/Dockerfile-7.4 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:7.4-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-8.0 b/Dockerfiles/slim/Dockerfile-8.0 index 1f0336b..49c8287 100644 --- a/Dockerfiles/slim/Dockerfile-8.0 +++ b/Dockerfiles/slim/Dockerfile-8.0 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:8.0-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-8.1 b/Dockerfiles/slim/Dockerfile-8.1 index 58b35e4..1a66f2a 100644 --- a/Dockerfiles/slim/Dockerfile-8.1 +++ b/Dockerfiles/slim/Dockerfile-8.1 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:8.1-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ diff --git a/Dockerfiles/slim/Dockerfile-8.2 b/Dockerfiles/slim/Dockerfile-8.2 index 6a23e31..8f70bef 100644 --- a/Dockerfiles/slim/Dockerfile-8.2 +++ b/Dockerfiles/slim/Dockerfile-8.2 @@ -207,6 +207,32 @@ RUN set -eux \ cp -r /usr/bin/mongo* /tmp/mongo/; \ fi +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + ######################################################################################################################## @@ -224,7 +250,7 @@ FROM devilbox/php-fpm:8.2-prod as devilbox-slim-base ARG ARCH ### -### Copy shared libraries +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) ### COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/