Skip to content

Commit b17eb55

Browse files
authored
Merge pull request #68 from kool-dev/node-20
Drop node 16; Add node 20/21
2 parents 6311fc5 + 67a2ed0 commit b17eb55

12 files changed

Lines changed: 113 additions & 15 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
version: [16, 18]
13+
version: [18, 20, 21]
1414
runs-on: [ubuntu-latest, buildjet-4vcpu-ubuntu-2204-arm]
1515
runs-on: ${{ matrix.runs-on }}
1616

@@ -65,7 +65,7 @@ jobs:
6565
runs-on: ubuntu-latest
6666
strategy:
6767
matrix:
68-
version: [16, 18]
68+
version: [18, 20, 21]
6969

7070
steps:
7171
- uses: docker/login-action@v3

16/Dockerfile renamed to 20/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16-alpine
1+
FROM node:20-alpine
22

33
ENV ASUSER= \
44
UID=0 \
File renamed without changes.
File renamed without changes.
File renamed without changes.

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

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@ Minimal [Node](https://nodejs.org/en/) Docker image. It's use is intended for [k
66

77
## Available Tags
88

9-
### 16
10-
11-
- [16](https://github.com/kool-dev/docker-node/blob/master/16/Dockerfile)
12-
139
### 18
1410

1511
- [18](https://github.com/kool-dev/docker-node/blob/master/18/Dockerfile)
1612

13+
### 20
14+
15+
- [20](https://github.com/kool-dev/docker-node/blob/master/20/Dockerfile)
16+
17+
### 21
18+
19+
- [21](https://github.com/kool-dev/docker-node/blob/master/21/Dockerfile)
20+
1721
### Legacy tags
1822

1923
The following images have been discontinued, but still exist on Hub Docker in case you need them. We strongly advise moving to the newer versions.
2024

2125
- [10](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10/Dockerfile), [10-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10-qa/Dockerfile), [10-adonis](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10-adonis/Dockerfile), [10-adonis-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10-adonis-qa/Dockerfile), [10-nest](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10-nest/Dockerfile), [10-nest-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/10-nest-qa/Dockerfile)
2226
- [12](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12/Dockerfile), [12-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12-qa/Dockerfile), [12-adonis](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12-adonis/Dockerfile), [12-adonis-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12-adonis-qa/Dockerfile), [12-nest](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12-nest/Dockerfile), [12-nest-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/12-nest-qa/Dockerfile)
2327
- [14](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14/Dockerfile), [14-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14-qa/Dockerfile), [14-adonis](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14-adonis/Dockerfile), [14-adonis-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14-adonis-qa/Dockerfile), [14-nest](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14-nest/Dockerfile), [14-nest-qa](https://github.com/kool-dev/docker-node/tree/legacy-2022-07/14-nest-qa/Dockerfile)
28+
- [16](https://github.com/kool-dev/docker-node/blob/master/16/Dockerfile)
2429

2530
## Environment Variables
2631

0 commit comments

Comments
 (0)