Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·89 lines (70 loc) · 2.81 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·89 lines (70 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM debian:13.8
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
ARG COREPACK_VERSION="0.36.0" \
DEBIAN_FRONTEND=noninteractive \
NODE_VERSION="26.13.1" \
SNAPSHOT=20261130T000000Z \
USER=node
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
PATH="$PATH:/home/$USER:/home/$USER/.yarn/releases"
RUN <<'EOF'
runtimeDeps=(
ca-certificates
curl
dirmngr
git
gpg
gpg-agent
libatomic1
shellcheck
sudo
tar
xz-utils
)
## every Debian package as of this day, so a rebuild installs the same versions
sed -i -e "s|http://deb.debian.org/\(.*\)|http://snapshot.debian.org/archive/\1/$SNAPSHOT|" \
-e '/^Suites:/a Check-Valid-Until: no' /etc/apt/sources.list.d/debian.sources
echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-snapshot
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends "${runtimeDeps[@]}"
apt-get dist-clean
groupadd --gid 1000 "$USER"
useradd --uid 1000 --gid "$USER" --shell /bin/bash --create-home "$USER"
echo "$USER:$USER" | chpasswd
echo "${USER} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/90-$USER"
for key in 5BE8A3F6C8A5C01D106C0AD820B1A390B168D356 DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 CC68F5A3106FF448322E48ED27F5E38D5B0A215F 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C 108F52B48DB57BB0CC439B2997B01419BD92F80A A363A499291CBBC940DD62E41F10027AF002F8B0;
do
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ;
done
NODE_TARBALL="node-v${NODE_VERSION}-linux-x64.tar.xz"
curl -fsSLO --compressed "https://nodejs.org/dist/v${NODE_VERSION}/${NODE_TARBALL}"
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 ~/.gnupg
grep "${NODE_TARBALL}\$" SHASUMS256.txt | sha256sum -c -
tar -xJf "${NODE_TARBALL}" -C /usr/local --strip-components=1 --no-same-owner
ln -s /usr/local/bin/node /usr/local/bin/nodejs
rm "${NODE_TARBALL}" SHASUMS256.txt.asc SHASUMS256.txt
rm -rf /tmp/*
node --version
npm --version
EOF
RUN npm install -g "corepack@$COREPACK_VERSION"
USER $USER
WORKDIR /home/$USER
COPY --chmod=755 <<'EOF' /usr/local/bin/docker-entrypoint.sh
#!/bin/sh
set -e
# Run command with node if the first argument contains a "-" or is not a system command. The last
# part inside the "{}" is a workaround for the following bug in ash/dash:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then
set -- node "$@"
fi
exec "$@"
EOF
ENTRYPOINT ["docker-entrypoint.sh"]
CMD [ "node" ]