@@ -5,14 +5,14 @@ RUN groupadd --gid 1000 node \
5
5
6
6
ENV NODE_VERSION 21.1.0
7
7
8
- RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
8
+ RUN ARCH= OPENSSL_ARCH= && dpkgArch="$(dpkg --print-architecture)" \
9
9
&& case "${dpkgArch##*-}" in \
10
- amd64) ARCH='x64' ;; \
11
- ppc64el) ARCH='ppc64le' ;; \
12
- s390x) ARCH='s390x' ;; \
13
- arm64) ARCH='arm64' ;; \
14
- armhf) ARCH='armv7l' ;; \
15
- i386) ARCH='x86' ;; \
10
+ amd64) ARCH='x64' OPENSSL_ARCH= 'linux-x86_64' ;; \
11
+ ppc64el) ARCH='ppc64le' OPENSSL_ARCH= 'linux-ppc64le' ;; \
12
+ s390x) ARCH='s390x' OPENSSL_ARCH= 'linux*-s390x' ;; \
13
+ arm64) ARCH='arm64' OPENSSL_ARCH= 'linux-aarch64' ;; \
14
+ armhf) ARCH='armv7l' OPENSSL_ARCH= 'linux-armv4' ;; \
15
+ i386) ARCH='x86' OPENSSL_ARCH= 'linux-elf' ;; \
16
16
*) echo "unsupported architecture" ; exit 1 ;; \
17
17
esac \
18
18
&& set -ex \
@@ -46,6 +46,8 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
46
46
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$ " SHASUMS256.txt | sha256sum -c - \
47
47
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
48
48
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
49
+ # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451
50
+ && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \
49
51
&& apt-mark auto '.*' > /dev/null \
50
52
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
51
53
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
0 commit comments