Skip to content

Commit

Permalink
Add Node debian core variant
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Apr 2, 2024
1 parent 85b7ec8 commit 9ac7599
Show file tree
Hide file tree
Showing 24 changed files with 314 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* text=auto eol=lf
/*/**/Dockerfile linguist-generated
/*/**/docker-entrypoint.sh linguist-generated
/Dockerfile*.template linguist-language=Dockerfile
13 changes: 13 additions & 0 deletions 18/bookworm-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 18/bookworm-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 18/bullseye-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 18/bullseye-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 18/buster-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 18/buster-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 20/bookworm-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 20/bookworm-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 20/bullseye-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 20/bullseye-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 20/buster-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added 20/buster-core/Dockerrfile
Empty file.
11 changes: 11 additions & 0 deletions 20/buster-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 21/bookworm-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 21/bookworm-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 21/bullseye-core/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 21/bullseye-core/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Dockerfile-debian-core.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM debian:name-slim

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

ENV NODE_VERSION 0.0.0

COPY --from=node:0.0.0 /usr/local/bin/ /usr/local/bin/
COPY --from=node:0.0.0 /usr/local/include/node/ /usr/local/include/node/

ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "node" ]
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,33 @@ The official Node.js docker image, made with love by the node community.
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents

- [What is Node.js?](#what-is-nodejs)
- [How to use this image](#how-to-use-this-image)
- [Create a `Dockerfile` in your Node.js app project](#create-a-dockerfile-in-your-nodejs-app-project)
- [Best Practices](#best-practices)
- [Run a single Node.js script](#run-a-single-nodejs-script)
- [Verbosity](#verbosity)
- [Dockerfile](#dockerfile)
- [Docker Run](#docker-run)
- [NPM run](#npm-run)
- [Image Variants](#image-variants)
- [`node:<version>`](#nodeversion)
- [`node:alpine`](#nodealpine)
- [`node:buster`](#nodebuster)
- [`node:bullseye`](#nodebullseye)
- [`node:bookworm`](#nodebookworm)
- [`node:slim`](#nodeslim)
- [License](#license)
- [Supported Docker versions](#supported-docker-versions)
- [Supported Node.js versions](#supported-nodejs-versions)
- [Governance and Current Members](#governance-and-current-members)
- [Docker Working Group Members](#docker-working-group-members)
- [Docker Working Group Collaborators](#docker-working-group-collaborators)
- [Emeritus](#emeritus)
- [Docker Working Group Members](#docker-working-group-members-1)
- [Node.js](#nodejs)
- [Table of Contents](#table-of-contents)
- [What is Node.js?](#what-is-nodejs)
- [How to use this image](#how-to-use-this-image)
- [Create a `Dockerfile` in your Node.js app project](#create-a-dockerfile-in-your-nodejs-app-project)
- [Best Practices](#best-practices)
- [Run a single Node.js script](#run-a-single-nodejs-script)
- [Verbosity](#verbosity)
- [Dockerfile](#dockerfile)
- [Docker Run](#docker-run)
- [NPM run](#npm-run)
- [Image Variants](#image-variants)
- [`node:<version>`](#nodeversion)
- [`node:alpine`](#nodealpine)
- [`node:buster`](#nodebuster)
- [`node:bullseye`](#nodebullseye)
- [`node:bookworm`](#nodebookworm)
- [`node:slim`](#nodeslim)
- [`node:core`](#nodecore)
- [License](#license)
- [Supported Docker versions](#supported-docker-versions)
- [Supported Node.js versions](#supported-nodejs-versions)
- [Governance and Current Members](#governance-and-current-members)
- [Docker Working Group Members](#docker-working-group-members)
- [Docker Working Group Collaborators](#docker-working-group-collaborators)
- [Emeritus](#emeritus)
- [Docker Working Group Members](#docker-working-group-members-1)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -223,6 +226,8 @@ in an environment where *only* the Node.js image will be deployed and you have
space constraints, we highly recommend using the default image of this
repository.

### `node:core`

## License

[License information](https://github.com/nodejs/node/blob/master/LICENSE) for
Expand Down
10 changes: 5 additions & 5 deletions architectures
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bashbrew-arch variants
amd64 alpine3.18,alpine3.19,bookworm,bookworm-slim,bullseye,bullseye-slim,buster,buster-slim
amd64 alpine3.18,alpine3.19,bookworm,bookworm-slim,bookworm-core,bullseye,bullseye-slim,bullseye-core,buster,buster-slim,buster-core
arm32v6 alpine3.18,alpine3.19
arm32v7 alpine3.18,alpine3.19,bookworm,bookworm-slim,bullseye,bullseye-slim,buster,buster-slim
arm64v8 alpine3.18,alpine3.19,bookworm,bookworm-slim,bullseye,bullseye-slim,buster,buster-slim
arm32v7 alpine3.18,alpine3.19,bookworm,bookworm-slim,bookworm-core,bullseye,bullseye-slim,bullseye-core,buster,buster-slim,buster-core
arm64v8 alpine3.18,alpine3.19,bookworm,bookworm-slim,bookworm-core,bullseye,bullseye-slim,bullseye-core,buster,buster-slim,buster-core
i386 alpine3.18,alpine3.19
ppc64le alpine3.18,alpine3.19,bookworm,bookworm-slim,bullseye,bullseye-slim,buster,buster-slim
s390x alpine3.18,alpine3.19,bookworm,bookworm-slim,bullseye,bullseye-slim,buster,buster-slim
ppc64le alpine3.18,alpine3.19,bookworm,bookworm-slim,bookworm-core,bullseye,bullseye-slim,bullseye-core,buster,buster-slim,buster-core
s390x alpine3.18,alpine3.19,bookworm,bookworm-slim,bookworm-core,bullseye,bullseye-slim,bullseye-core,buster,buster-slim,buster-core
14 changes: 14 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,20 @@ function is_debian_slim() {
return 1
}

function is_debian_core() {
local variant
variant=$1
shift

IFS=' ' read -ra debianVersions <<< "$(get_config "./" "debian_versions")"
for d in "${debianVersions[@]}"; do
if [ "${d}-core" = "${variant}" ]; then
return 0
fi
done
return 1
}

function get_fork_name() {
local version
version=$1
Expand Down
6 changes: 6 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function update_node_version() {

sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}-tmp"
sed -Ei -e 's/^(ENV NODE_VERSION ).*/\1'"${nodeVersion}"'/' "${dockerfile}-tmp"
sed -Ei -e 's/^(COPY --from=node:)[^ ]*/\1'"${nodeVersion}"'/' "${dockerfile}-tmp"

currentYarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${currentYarnVersion}"'/' "${dockerfile}-tmp"
Expand Down Expand Up @@ -167,6 +168,8 @@ function update_node_version() {
sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp"
elif is_debian_slim "${variant}"; then
sed -Ei -e "s/(debian:)name-slim/\\1${variant}/" "${dockerfile}-tmp"
elif is_debian_core "${variant}"; then
sed -Ei -e "s/(debian:)name-slim/\\1${variant%"-core"}-slim/" "${dockerfile}-tmp"
fi

if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
Expand Down Expand Up @@ -211,6 +214,7 @@ for version in "${versions[@]}"; do
fi

for variant in "${variants[@]}"; do

# Skip non-docker directories
[ -f "${version}/${variant}/Dockerfile" ] || continue

Expand All @@ -221,6 +225,8 @@ for version in "${versions[@]}"; do
template_file="${parentpath}/Dockerfile-debian.template"
elif is_debian_slim "${variant}"; then
template_file="${parentpath}/Dockerfile-slim.template"
elif is_debian_core "${variant}"; then
template_file="${parentpath}/Dockerfile-debian-core.template"
elif is_alpine "${variant}"; then
template_file="${parentpath}/Dockerfile-alpine.template"
fi
Expand Down
Loading

0 comments on commit 9ac7599

Please sign in to comment.