-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node-distroless): add node-distroless image combines google dist…
…roless and dump-init
- Loading branch information
Showing
7 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node:20-alpine AS init | ||
RUN apk add --no-cache dumb-init | ||
|
||
FROM gcr.io/distroless/nodejs22 AS runtime | ||
COPY --from=init /usr/bin/dumb-init /usr/bin/dumb-init | ||
ENTRYPOINT [ "/usr/bin/dumb-init", "--", "/nodejs/bin/node" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node-distroless:edge | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY images/node-distroless/main.js . | ||
|
||
CMD [ "main.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('NODE VERSION:' + process.version); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"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=image"] | ||
} | ||
}, | ||
"build-test": { | ||
"dependsOn": ["build"], | ||
"executor": "@ebizbase/nx-docker:build", | ||
"options": { | ||
"file": "images/node-distroless/Dockerfile.test", | ||
"tags": ["node-distroless:test"], | ||
"outputs": ["type=image"] | ||
} | ||
}, | ||
"test": { | ||
"dependsOn": ["build-test"], | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "docker run --rm node-distroless:test" | ||
} | ||
}, | ||
"publish": { | ||
"executor": "@ebizbase/nx-docker:build", | ||
"options": { | ||
"tags": ["ghcr.io/ebizbase/node-distroless"], | ||
"outputs": ["type=image"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters