Skip to content

Commit

Permalink
add node 21
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciojs committed Oct 22, 2023
1 parent b6490fc commit 1ce513e
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
38 changes: 38 additions & 0 deletions 21/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM node:21-alpine

ENV ASUSER= \
UID=0 \
ENTRYPOINT=entrypoint.node.sh

WORKDIR /app

RUN adduser -D -u 1337 kool && deluser --remove-home node \
# deps
&& apk add --no-cache \
bash \
git \
shadow \
su-exec \
curl \
# build tools
g++ \
libpng-dev \
make \
zlib-dev \
&& npm install -g pnpm \
&& rm -rf rm -rf /root/.npm/* \
# dockerize
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-alpine-linux-amd64-v0.6.1.tar.gz | tar xz \
&& mv dockerize /usr/local/bin/dockerize

COPY root-npmrc /root/.npmrc
COPY --chown=kool:kool kool-npmrc /home/kool/.npmrc
COPY entrypoint /entrypoint

RUN chmod +x /entrypoint

RUN mkdir -p /usr/local/lib/node_modules && chmod -R 777 /usr/local/lib/node_modules

RUN npm i --location=global npm@latest

ENTRYPOINT [ "/entrypoint" ]
20 changes: 20 additions & 0 deletions 21/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -e

# Run as current user
CURRENT_USER=${ASUSER:-${UID:-0}}

if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
usermod -u $CURRENT_USER kool
fi

# Run entrypoint if provided
if [ ! -z "$ENTRYPOINT" ] && [ -f "$ENTRYPOINT" ]; then
bash $ENTRYPOINT
fi

if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
exec su-exec kool "$@"
else
exec "$@"
fi
4 changes: 4 additions & 0 deletions 21/kool-npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scripts-prepend-node-path=true
package-import-method=copy
shamefully-hoist=true
store-dir=/home/kool/.pnpm-store
4 changes: 4 additions & 0 deletions 21/root-npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scripts-prepend-node-path=true
package-import-method=copy
shamefully-hoist=true
store-dir=/root/.pnpm-store
25 changes: 25 additions & 0 deletions fwd-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,31 @@
"path": "template/root-npmrc"
}
]
},
{
"name": "21",
"data": {
"from": "node:21-alpine",
"version": "21"
},
"files": [
{
"name": "Dockerfile",
"path": "template/Dockerfile"
},
{
"name": "entrypoint",
"path": "template/entrypoint"
},
{
"name": "kool-npmrc",
"path": "template/kool-npmrc"
},
{
"name": "root-npmrc",
"path": "template/root-npmrc"
}
]
}
]
}
2 changes: 2 additions & 0 deletions kool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ scripts:
- docker build --pull -t kooldev/node:18 18
# node 20
- docker build --pull -t kooldev/node:20 20
# node 21
- docker build --pull -t kooldev/node:21 21

0 comments on commit 1ce513e

Please sign in to comment.