Skip to content

Commit 89afeed

Browse files
committed
Remove unused openssl headers from alpine images as well
1 parent 6759947 commit 89afeed

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Dockerfile-alpine.template

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ RUN addgroup -g 1000 node \
88
libstdc++ \
99
&& apk add --no-cache --virtual .build-deps \
1010
curl \
11-
&& ARCH= && alpineArch="$(apk --print-arch)" \
11+
&& ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \
1212
&& case "${alpineArch##*-}" in \
13-
x86_64) \
14-
ARCH='x64' \
15-
CHECKSUM=CHECKSUM_x64 \
16-
;; \
13+
x86_64) ARCH='x64' CHECKSUM=CHECKSUM_x64 OPENSSL_ARCH=linux-x86_64;; \
14+
x86) OPENSSL_ARCH=linux-elf;; \
15+
aarch64) OPENSSL_ARCH=linux-aarch64;; \
16+
arm*) OPENSSL_ARCH=linux-armv4;; \
17+
ppc64le) OPENSSL_ARCH=linux-ppc64le;; \
18+
s390x) OPENSSL_ARCH=linux-s390x;; \
1719
*) ;; \
1820
esac \
1921
&& if [ -n "${CHECKSUM}" ]; then \
@@ -60,6 +62,8 @@ RUN addgroup -g 1000 node \
6062
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
6163
fi \
6264
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \
65+
# Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451
66+
&& find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \
6367
&& apk del .build-deps \
6468
# smoke tests
6569
&& node --version \

0 commit comments

Comments
 (0)