Remove unused openssl headers from alpine images as well

This commit is contained in:
Yehonatan Zecharia 2023-11-14 10:12:57 +02:00 committed by Yehonatan Zecharia
parent 6759947fb3
commit 89afeedf05
1 changed files with 9 additions and 5 deletions

View File

@ -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 \