@@ -17,32 +17,19 @@ RUN ARCH= OPENSSL_ARCH= && dpkgArch="$(dpkg --print-architecture)" \
1717 esac \
1818 && set -ex \
1919 # libatomic1 for arm
20- && apt-get update && apt-get install -y ca-certificates curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
20+ && apt-get update && apt-get install -y ca-certificates curl wget gpgv dirmngr xz-utils libatomic1 --no-install-recommends \
2121 && rm -rf /var/lib/apt/lists/* \
22- # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
2322 && export GNUPGHOME="$(mktemp -d)" \
24- # gpg keys listed at https://github.com/nodejs/node#release-keys
25- && for key in \
26- 5BE8A3F6C8A5C01D106C0AD820B1A390B168D356 \
27- DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \
28- CC68F5A3106FF448322E48ED27F5E38D5B0A215F \
29- 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
30- 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
31- C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
32- 108F52B48DB57BB0CC439B2997B01419BD92F80A \
33- A363A499291CBBC940DD62E41F10027AF002F8B0 \
34- ; do \
35- { gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key" ; } || \
36- { gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key" ; } ; \
37- done \
38- && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
39- && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
40- && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
41- && gpgconf --kill all \
23+ && set -exo pipefail \
24+ && (cd "$GNUPGHOME" && curl -fsSLO --compressed "https://raw.githubusercontent.com/nodejs/release-keys/b362bd15f2ac7ce350d7563fc03e0c625e455e5f/gpg-only-active-keys/pubring.kbx" && echo "6676a927d6261a7ab6bb4ddc69614823567426bb9ac77aee484cfb5d66f4a148 pubring.kbx" | sha256sum -c) \
25+ && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
26+ && curl -fsSL --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
27+ | gpgv --keyring="$GNUPGHOME/pubring.kbx" --output - \
28+ | grep " node-v$NODE_VERSION.tar.xz\$ "
29+ | sha256sum -c - \
4230 && rm -rf "$GNUPGHOME" \
43- && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$ " SHASUMS256.txt | sha256sum -c - \
4431 && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
45- && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
32+ && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
4633 # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451
4734 && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \
4835 && apt-mark auto '.*' > /dev/null \
0 commit comments