From 89afeedf0542d995e7be5e99e30719fc7b2f512d Mon Sep 17 00:00:00 2001 From: Yehonatan Zecharia Date: Tue, 14 Nov 2023 10:12:57 +0200 Subject: [PATCH] Remove unused openssl headers from alpine images as well --- Dockerfile-alpine.template | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 553da29b..5da2bb7c 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -8,12 +8,14 @@ RUN addgroup -g 1000 node \ libstdc++ \ && apk add --no-cache --virtual .build-deps \ curl \ - && ARCH= && alpineArch="$(apk --print-arch)" \ + && ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \ && case "${alpineArch##*-}" in \ - x86_64) \ - ARCH='x64' \ - CHECKSUM=CHECKSUM_x64 \ - ;; \ + x86_64) ARCH='x64' CHECKSUM=CHECKSUM_x64 OPENSSL_ARCH=linux-x86_64;; \ + x86) OPENSSL_ARCH=linux-elf;; \ + aarch64) OPENSSL_ARCH=linux-aarch64;; \ + arm*) OPENSSL_ARCH=linux-armv4;; \ + ppc64le) OPENSSL_ARCH=linux-ppc64le;; \ + s390x) OPENSSL_ARCH=linux-s390x;; \ *) ;; \ esac \ && if [ -n "${CHECKSUM}" ]; then \ @@ -60,6 +62,8 @@ RUN addgroup -g 1000 node \ && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ fi \ && rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \ + # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 + && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \ && apk del .build-deps \ # smoke tests && node --version \