Skip to content

Commit 1ce513e

Browse files
committed
add node 21
1 parent b6490fc commit 1ce513e

6 files changed

Lines changed: 93 additions & 0 deletions

File tree

21/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:21-alpine
2+
3+
ENV ASUSER= \
4+
UID=0 \
5+
ENTRYPOINT=entrypoint.node.sh
6+
7+
WORKDIR /app
8+
9+
RUN adduser -D -u 1337 kool && deluser --remove-home node \
10+
# deps
11+
&& apk add --no-cache \
12+
bash \
13+
git \
14+
shadow \
15+
su-exec \
16+
curl \
17+
# build tools
18+
g++ \
19+
libpng-dev \
20+
make \
21+
zlib-dev \
22+
&& npm install -g pnpm \
23+
&& rm -rf rm -rf /root/.npm/* \
24+
# dockerize
25+
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-alpine-linux-amd64-v0.6.1.tar.gz | tar xz \
26+
&& mv dockerize /usr/local/bin/dockerize
27+
28+
COPY root-npmrc /root/.npmrc
29+
COPY --chown=kool:kool kool-npmrc /home/kool/.npmrc
30+
COPY entrypoint /entrypoint
31+
32+
RUN chmod +x /entrypoint
33+
34+
RUN mkdir -p /usr/local/lib/node_modules && chmod -R 777 /usr/local/lib/node_modules
35+
36+
RUN npm i --location=global npm@latest
37+
38+
ENTRYPOINT [ "/entrypoint" ]

21/entrypoint

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Run as current user
5+
CURRENT_USER=${ASUSER:-${UID:-0}}
6+
7+
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
8+
usermod -u $CURRENT_USER kool
9+
fi
10+
11+
# Run entrypoint if provided
12+
if [ ! -z "$ENTRYPOINT" ] && [ -f "$ENTRYPOINT" ]; then
13+
bash $ENTRYPOINT
14+
fi
15+
16+
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
17+
exec su-exec kool "$@"
18+
else
19+
exec "$@"
20+
fi

21/kool-npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scripts-prepend-node-path=true
2+
package-import-method=copy
3+
shamefully-hoist=true
4+
store-dir=/home/kool/.pnpm-store

21/root-npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scripts-prepend-node-path=true
2+
package-import-method=copy
3+
shamefully-hoist=true
4+
store-dir=/root/.pnpm-store

fwd-template.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,31 @@
5050
"path": "template/root-npmrc"
5151
}
5252
]
53+
},
54+
{
55+
"name": "21",
56+
"data": {
57+
"from": "node:21-alpine",
58+
"version": "21"
59+
},
60+
"files": [
61+
{
62+
"name": "Dockerfile",
63+
"path": "template/Dockerfile"
64+
},
65+
{
66+
"name": "entrypoint",
67+
"path": "template/entrypoint"
68+
},
69+
{
70+
"name": "kool-npmrc",
71+
"path": "template/kool-npmrc"
72+
},
73+
{
74+
"name": "root-npmrc",
75+
"path": "template/root-npmrc"
76+
}
77+
]
5378
}
5479
]
5580
}

kool.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ scripts:
77
- docker build --pull -t kooldev/node:18 18
88
# node 20
99
- docker build --pull -t kooldev/node:20 20
10+
# node 21
11+
- docker build --pull -t kooldev/node:21 21

0 commit comments

Comments
 (0)