diff --git a/images/node-distroless/Dockerfile b/images/node-distroless/Dockerfile new file mode 100644 index 0000000..437c736 --- /dev/null +++ b/images/node-distroless/Dockerfile @@ -0,0 +1,6 @@ +FROM node:22-alpine AS init +RUN apk add --no-cache dumb-init + +FROM gcr.io/distroless/nodejs22:latest AS runtime +COPY --from=init /usr/bin/dumb-init /usr/bin/dumb-init +ENTRYPOINT [ "/usr/bin/dumb-init", "--", "/nodejs/bin/node" ] diff --git a/images/node-distroless/README.md b/images/node-distroless/README.md new file mode 100644 index 0000000..aded9a7 --- /dev/null +++ b/images/node-distroless/README.md @@ -0,0 +1,16 @@ +# node-distroless + +This image combines the compactness and security of distroless with the convenience of dumb-init for process management, making Node.js applications run more stably in a container environment. + +> This image is maintained with node latest LTS version + +## Usage + +The simple usage example + +```dockerfile +FROM ghcr.io/ebizbase/node-distroless +WORKDIR /usr/src/app +COPY . . +CMD [ "index.js" ] +``` diff --git a/images/node-distroless/project.json b/images/node-distroless/project.json new file mode 100644 index 0000000..c501927 --- /dev/null +++ b/images/node-distroless/project.json @@ -0,0 +1,32 @@ +{ + "name": "node-distroless", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "metadata": { + "version": "0.0.0" + }, + "tags": [], + "targets": { + "build": { + "executor": "@ebizbase/nx-docker:build", + "options": { + "tags": ["node-distroless:edge"], + "outputs": ["type=docker"] + } + }, + "test": { + "dependsOn": ["build"], + "executor": "nx:run-commands", + "options": { + "command": "docker run --rm node-distroless:edge -e 'console.log(process.version)'" + } + }, + "publish": { + "executor": "@ebizbase/nx-docker:build", + "options": { + "tags": ["ghcr.io/ebizbase/node-distroless"], + "outputs": ["type=image"] + } + } + } +} diff --git a/release-config.json b/release-config.json index 30d4e61..b70f0f2 100644 --- a/release-config.json +++ b/release-config.json @@ -103,6 +103,16 @@ "jsonpath": "$.metadata.version" } ] + }, + "images/node-distroless": { + "package-name": "node-distroless", + "extra-files": [ + { + "type": "json", + "path": "project.json", + "jsonpath": "$.metadata.version" + } + ] } } } diff --git a/release-manifest.json b/release-manifest.json index 289f425..5ed5b94 100644 --- a/release-manifest.json +++ b/release-manifest.json @@ -10,5 +10,6 @@ "devcontainer-images/node-devcontainer": "1.0.0", "devcontainer-images/node-dind-devcontainer": "1.0.0", "devcontainer-images/node-dind-playwright-devcontainer": "1.0.0", - "devcontainer-images/node-playwright-devcontainer": "1.0.0" + "devcontainer-images/node-playwright-devcontainer": "1.0.0", + "images/node-distroless": "0.0.0" }