From 51619156b3d796d159b87ffa49248d24f970adb0 Mon Sep 17 00:00:00 2001 From: Gilmar Pereira Date: Tue, 1 Oct 2024 07:46:03 -0300 Subject: [PATCH 1/5] add: node 22 - lts --- 22/Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 22/entrypoint | 20 ++++++++++++++++++++ 22/kool-npmrc | 4 ++++ 22/root-npmrc | 4 ++++ fwd-template.json | 25 +++++++++++++++++++++++++ kool.yml | 2 ++ 6 files changed, 93 insertions(+) create mode 100644 22/Dockerfile create mode 100644 22/entrypoint create mode 100644 22/kool-npmrc create mode 100644 22/root-npmrc diff --git a/22/Dockerfile b/22/Dockerfile new file mode 100644 index 0000000..20b95bb --- /dev/null +++ b/22/Dockerfile @@ -0,0 +1,38 @@ +FROM node:22-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" ] diff --git a/22/entrypoint b/22/entrypoint new file mode 100644 index 0000000..00c6ebd --- /dev/null +++ b/22/entrypoint @@ -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 diff --git a/22/kool-npmrc b/22/kool-npmrc new file mode 100644 index 0000000..205dec9 --- /dev/null +++ b/22/kool-npmrc @@ -0,0 +1,4 @@ +scripts-prepend-node-path=true +package-import-method=copy +shamefully-hoist=true +store-dir=/home/kool/.pnpm-store diff --git a/22/root-npmrc b/22/root-npmrc new file mode 100644 index 0000000..34f1b46 --- /dev/null +++ b/22/root-npmrc @@ -0,0 +1,4 @@ +scripts-prepend-node-path=true +package-import-method=copy +shamefully-hoist=true +store-dir=/root/.pnpm-store diff --git a/fwd-template.json b/fwd-template.json index 449fb40..a05f92d 100644 --- a/fwd-template.json +++ b/fwd-template.json @@ -75,6 +75,31 @@ "path": "template/root-npmrc" } ] + }, + { + "name": "22", + "data": { + "from": "node:22-alpine", + "version": "22" + }, + "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" + } + ] } ] } diff --git a/kool.yml b/kool.yml index 254707a..9bf174f 100644 --- a/kool.yml +++ b/kool.yml @@ -9,3 +9,5 @@ scripts: - docker build --pull -t kooldev/node:20 20 # node 21 - docker build --pull -t kooldev/node:21 21 + # node 22 + - docker build --pull -t kooldev/node:22 22 From 72f1b0baee9fa38ca6a97daa70a7e0a2be824e02 Mon Sep 17 00:00:00 2001 From: Gilmar Pereira Date: Tue, 1 Oct 2024 07:57:31 -0300 Subject: [PATCH 2/5] remove: node 21, eol --- 21/Dockerfile | 38 -------------------------------------- 21/entrypoint | 20 -------------------- 21/kool-npmrc | 4 ---- 21/root-npmrc | 4 ---- README.md | 5 +++-- 5 files changed, 3 insertions(+), 68 deletions(-) delete mode 100644 21/Dockerfile delete mode 100644 21/entrypoint delete mode 100644 21/kool-npmrc delete mode 100644 21/root-npmrc diff --git a/21/Dockerfile b/21/Dockerfile deleted file mode 100644 index ad0013c..0000000 --- a/21/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -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" ] diff --git a/21/entrypoint b/21/entrypoint deleted file mode 100644 index 00c6ebd..0000000 --- a/21/entrypoint +++ /dev/null @@ -1,20 +0,0 @@ -#!/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 diff --git a/21/kool-npmrc b/21/kool-npmrc deleted file mode 100644 index 205dec9..0000000 --- a/21/kool-npmrc +++ /dev/null @@ -1,4 +0,0 @@ -scripts-prepend-node-path=true -package-import-method=copy -shamefully-hoist=true -store-dir=/home/kool/.pnpm-store diff --git a/21/root-npmrc b/21/root-npmrc deleted file mode 100644 index 34f1b46..0000000 --- a/21/root-npmrc +++ /dev/null @@ -1,4 +0,0 @@ -scripts-prepend-node-path=true -package-import-method=copy -shamefully-hoist=true -store-dir=/root/.pnpm-store diff --git a/README.md b/README.md index 7756ee2..60f4176 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ Minimal [Node](https://nodejs.org/en/) Docker image. It's use is intended for [k - [20](https://github.com/kool-dev/docker-node/blob/master/20/Dockerfile) -### 21 +### 22 -- [21](https://github.com/kool-dev/docker-node/blob/master/21/Dockerfile) +- [22](https://github.com/kool-dev/docker-node/blob/master/22/Dockerfile) ### Legacy tags @@ -26,6 +26,7 @@ The following images have been discontinued, but still exist on Hub Docker in ca - [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) - [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) - [16](https://github.com/kool-dev/docker-node/blob/master/16/Dockerfile) +- [21](https://github.com/kool-dev/docker-node/blob/master/21/Dockerfile) ## Environment Variables From 6a41bc1b5d83ec0d35fca2258c738e3af8352e36 Mon Sep 17 00:00:00 2001 From: Gilmar Pereira Date: Tue, 1 Oct 2024 08:01:37 -0300 Subject: [PATCH 3/5] tweak --- fwd-template.json | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/fwd-template.json b/fwd-template.json index a05f92d..4b0cb73 100644 --- a/fwd-template.json +++ b/fwd-template.json @@ -51,31 +51,6 @@ } ] }, - { - "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" - } - ] - }, { "name": "22", "data": { From 0497ef7ea6dd8c96d61a3f0441f3053a6dad966d Mon Sep 17 00:00:00 2001 From: Gilmar Pereira Date: Tue, 1 Oct 2024 08:05:26 -0300 Subject: [PATCH 4/5] tweak --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 60f4176..d9ff870 100644 --- a/README.md +++ b/README.md @@ -40,20 +40,20 @@ Variable | Default Value | Description With `docker run`: ```sh -docker run -it --rm kooldev/node:20 node -v +docker run -it --rm kooldev/node:22 node -v ``` With environment variables: ```sh -docker run -it --rm -e ASUSER=500 kooldev/node:20 node -v +docker run -it --rm -e ASUSER=500 kooldev/node:22 node -v ``` With `docker-compose.yml`: ```yaml app: - image: kooldev/node:20 + image: kooldev/node:22 environment: ASUSER: "${$UID}" ``` From 027101b2c7899a86256cfef86f7ac0b4c6eb7f51 Mon Sep 17 00:00:00 2001 From: Gilmar Pereira Date: Tue, 1 Oct 2024 08:07:38 -0300 Subject: [PATCH 5/5] tweak --- kool.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/kool.yml b/kool.yml index 9bf174f..5cc68cf 100644 --- a/kool.yml +++ b/kool.yml @@ -7,7 +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 # node 22 - docker build --pull -t kooldev/node:22 22