Skip to content

Commit 6759947

Browse files
committed
Run update.sh for slim images (not ran after previous PR)
1 parent dbc1745 commit 6759947

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

21/bookworm-slim/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ RUN groupadd --gid 1000 node \
55

66
ENV NODE_VERSION 21.1.0
77

8-
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
8+
RUN ARCH= OPENSSL_ARCH= && dpkgArch="$(dpkg --print-architecture)" \
99
&& 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';; \
1616
*) echo "unsupported architecture"; exit 1 ;; \
1717
esac \
1818
&& set -ex \
@@ -46,6 +46,8 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
4646
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
4747
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
4848
&& 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 {} \; \
4951
&& apt-mark auto '.*' > /dev/null \
5052
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
5153
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \

21/bullseye-slim/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ RUN groupadd --gid 1000 node \
55

66
ENV NODE_VERSION 21.1.0
77

8-
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
8+
RUN ARCH= OPENSSL_ARCH= && dpkgArch="$(dpkg --print-architecture)" \
99
&& 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';; \
1616
*) echo "unsupported architecture"; exit 1 ;; \
1717
esac \
1818
&& set -ex \
@@ -46,6 +46,8 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
4646
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
4747
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
4848
&& 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 {} \; \
4951
&& apt-mark auto '.*' > /dev/null \
5052
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
5153
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \

0 commit comments

Comments
 (0)