Skip to content

Commit d982a54

Browse files
committed
Update Docker image to use trixie-slim
Also: - Move ENV to the top - Install required deps - Create GNUPGHOME - Do everything in one Docker layer - Smoke test node and npm
1 parent 617bfdf commit d982a54

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

14/Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
FROM buildpack-deps:buster
1+
FROM debian:trixie-slim
2+
3+
ENV NPM_CONFIG_LOGLEVEL=info
4+
ENV NODE_VERSION=14.17.1
25

36
# gpg keys listed at https://github.com/nodejs/node
47
RUN set -ex \
8+
&& apt-get update \
9+
&& apt-get install -y ca-certificates curl gnupg dirmngr xz-utils --no-install-recommends \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
12+
&& export GNUPGHOME="$(mktemp -d)" \
513
&& for key in \
614
4ED778F539E3634C779C87C6D7062848A1AB005C \
715
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
@@ -17,16 +25,16 @@ RUN set -ex \
1725
; do \
1826
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
1927
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ; \
20-
done
21-
22-
ENV NPM_CONFIG_LOGLEVEL=info
23-
ENV NODE_VERSION=14.17.1
24-
25-
RUN curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
28+
done \
29+
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
2630
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
2731
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
32+
&& gpgconf --kill all \
33+
&& rm -rf "$GNUPGHOME" \
2834
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
2935
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
30-
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
36+
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
37+
&& node --version \
38+
&& npm --version
3139

3240
CMD [ "node" ]

0 commit comments

Comments
 (0)