-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,9 @@ | ||
FROM betterweb/alpine:latest AS builder | ||
ARG ALPINE_VERSION=3.19 | ||
ARG NODE_MAJOR=20 | ||
ARG NODE_VERSION=20.0.0 | ||
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS builder | ||
|
||
ARG NODE_VERSION=v20.0.0 | ||
|
||
# Install python/pip - https://stackoverflow.com/a/62555259 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN addgroup -g 1000 node \ | ||
&& adduser -u 1000 -G node -s /bin/sh -D node \ | ||
&& apk add --no-cache \ | ||
libstdc++ \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
curl \ | ||
&& ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \ | ||
&& case "${alpineArch##*-}" in \ | ||
x86_64) ARCH='x64' DOWNLOAD="YES" OPENSSL_ARCH=linux-x86_64;; \ | ||
x86) OPENSSL_ARCH=linux-elf;; \ | ||
aarch64) OPENSSL_ARCH=linux-aarch64;; \ | ||
arm*) OPENSSL_ARCH=linux-armv4;; \ | ||
ppc64le) OPENSSL_ARCH=linux-ppc64le;; \ | ||
s390x) OPENSSL_ARCH=linux-s390x;; \ | ||
*) ;; \ | ||
esac \ | ||
&& if [ -n "${DOWNLOAD}" ]; then \ | ||
set -eu; \ | ||
curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \ | ||
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ | ||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs; \ | ||
else \ | ||
echo "Building from source" \ | ||
# backup build | ||
&& apk add --no-cache --virtual .build-deps-full \ | ||
binutils-gold \ | ||
g++ \ | ||
gcc \ | ||
gnupg \ | ||
libgcc \ | ||
linux-headers \ | ||
make \ | ||
python3 \ | ||
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
# gpg keys listed at https://github.com/nodejs/node#release-keys | ||
&& for key in \ | ||
# Beth Griggs <[email protected]> | ||
4ED778F539E3634C779C87C6D7062848A1AB005C \ | ||
# Bryan English <[email protected]> | ||
141F07595B7B3FFE74309A937405533BE57C7D57 \ | ||
# Danielle Adams <[email protected]> | ||
74F12602B6F1C4E913FAA37AD3A89613643B6201 \ | ||
# Juan José Arboleda <[email protected]> | ||
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ | ||
# Michaël Zasso <[email protected]> | ||
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | ||
# Myles Borins <[email protected]> | ||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | ||
# RafaelGSS <[email protected]> | ||
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ | ||
# Richard Lau <[email protected]> | ||
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ | ||
# Ruy Adorno <[email protected]> | ||
108F52B48DB57BB0CC439B2997B01419BD92F80A \ | ||
# Ulises Gascón <[email protected]> | ||
A363A499291CBBC940DD62E41F10027AF002F8B0 \ | ||
# Chris Dickinson <[email protected]> | ||
9554F04D7259F04124DE6B476D5A82AC7E37093B \ | ||
# Colin Ihrig <[email protected]> | ||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | ||
# Danielle Adams <[email protected]> | ||
1C050899334244A8AF75E53792EF661D867B9DFA \ | ||
# Evan Lucas <[email protected]> | ||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | ||
# Gibson Fahnestock <[email protected]> | ||
77984A986EBC2AA786BC0F66B01FBB92821C587A \ | ||
# Isaac Z. Schlueter <[email protected]> | ||
93C7E9E91B49E432C2F75674B0A78B0A6C481CF6 \ | ||
# Italo A. Casas <[email protected]> | ||
56730D5401028683275BD23C23EFEFE93C4CFFFE \ | ||
# James M Snell <[email protected]> | ||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | ||
# Jeremiah Senkpiel <[email protected]> | ||
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | ||
# Juan José Arboleda <[email protected]> | ||
61FC681DFB92A079F1685E77973F295594EC4689 \ | ||
# Julien Gilli <[email protected]> | ||
114F43EE0176B71C7BC219DD50A3051F888C628D \ | ||
# Rod Vagg <[email protected]> | ||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | ||
# Ruben Bridgewater <[email protected]> | ||
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ | ||
# Shelley Vohr <[email protected]> | ||
B9E2F5981AA6E0CD28160D9FF13993A75599653C \ | ||
# Timothy J Fontaine <[email protected]> | ||
7937DFD2AB06298B2293C3187D33FF9D0246406D \ | ||
; do \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ | ||
done \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | ||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | ||
&& gpgconf --kill all \ | ||
&& rm -rf "$GNUPGHOME" \ | ||
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | ||
&& tar -xf "node-v$NODE_VERSION.tar.xz" \ | ||
&& cd "node-v$NODE_VERSION" \ | ||
&& ./configure \ | ||
&& make -j$(getconf _NPROCESSORS_ONLN) V= \ | ||
&& make install \ | ||
&& apk del .build-deps-full \ | ||
&& cd .. \ | ||
&& rm -Rf "node-v$NODE_VERSION" \ | ||
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ | ||
fi \ | ||
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \ | ||
# Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 | ||
&& find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \ | ||
&& apk del .build-deps \ | ||
# smoke tests | ||
&& node --version \ | ||
&& npm --version | ||
|
||
FROM betterweb/alpine:latest | ||
FROM betterweb/alpine:${ALPINE_VERSION} | ||
COPY --from=builder /usr/local /usr/local | ||
COPY install_packages.sh /usr/local/bin/install_packages | ||
COPY docker-entrypoint.sh /entrypoint.sh | ||
|