Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use_repo(busybox, "busybox_amd64", "busybox_arm", "busybox_arm64", "busybox_ppc6
### NODE ###
node = use_extension("//private/extensions:node.bzl", "node")
node.archive()
use_repo(node, "nodejs22_amd64", "nodejs22_arm", "nodejs22_arm64", "nodejs22_ppc64le", "nodejs22_s390x", "nodejs24_amd64", "nodejs24_arm64", "nodejs24_ppc64le", "nodejs24_s390x")
use_repo(node, "nodejs22_amd64", "nodejs22_arm", "nodejs22_arm64", "nodejs22_ppc64le", "nodejs22_s390x", "nodejs24_amd64", "nodejs24_arm64", "nodejs24_ppc64le", "nodejs24_s390x", "nodejs26_amd64", "nodejs26_arm64", "nodejs26_ppc64le", "nodejs26_s390x")

### DEBIAN ###
include("//private/repos/deb:deb.MODULE.bazel")
68 changes: 64 additions & 4 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Debian 13 distroless images use the debian [UsrMerge](https://wiki.debian.org/Us
| gcr.io/distroless/java25-debian13 | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le, riscv64 |
| gcr.io/distroless/nodejs22-debian13 | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |
| gcr.io/distroless/nodejs24-debian13 | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le |
| gcr.io/distroless/nodejs26-debian13 | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le |
| gcr.io/distroless/python3-debian13 | latest, nonroot, debug, debug-nonroot | amd64, arm64, riscv64 |

#### Debian 12
Expand Down
2 changes: 1 addition & 1 deletion knife
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function cmd_update_node_archives () {
fi

versions=()
for major in 22 24; do
for major in 22 24 26; do
latest_version=$(curl -sSL https://nodejs.org/dist/index.json | jq -r --arg major "v$major" '
map(select(.version | startswith($major)))
| sort_by(.date) | reverse | .[0].version
Expand Down
2 changes: 1 addition & 1 deletion nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ These images contain a minimal Linux, Node.js-based runtime. The supported versi

Specifically, these images contain everything in the [cc image](../cc/README.md), plus one of:

- Node.js v20 (`gcr.io/distroless/nodejs20-debian13`) and its dependencies.
- Node.js v22 (`gcr.io/distroless/nodejs22-debian13`) and its dependencies.
- Node.js v24 (`gcr.io/distroless/nodejs24-debian13`) and its dependencies.
- Node.js v26 (`gcr.io/distroless/nodejs26-debian13`) and its dependencies.

## Usage

Expand Down
3 changes: 2 additions & 1 deletion nodejs/config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ NODEJS_ARCHITECTURES = {
"debian13": {
"22": ["amd64", "arm64", "arm", "s390x", "ppc64le"],
"24": ["amd64", "arm64", "s390x", "ppc64le"],
"26": ["amd64", "arm64", "s390x", "ppc64le"],
},
}
NODEJS_MAJOR_VERSIONS = ["22", "24"]
NODEJS_MAJOR_VERSIONS = ["22", "24", "26"]
10 changes: 9 additions & 1 deletion nodejs/nodejs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index")
load("//common:variables.bzl", "DEBUG_MODE", "USERS")
load("//private/util:deb.bzl", "deb")
load("//private/util:tar.bzl", "tar")

def nodejs_image_index(distro, major_version, architectures):
Expand Down Expand Up @@ -42,6 +43,13 @@ def nodejs_image(distro, major_version, arch):
major_version: version of nodejs
arch: the target arch
"""

# node 26 and later dynamically link libatomic.so.1, which isn't in the cc base image.
# Layer libatomic1 onto the nodejs26+ images only so we don't bloat other images.
extra_tars = []
if int(major_version) >= 26:
extra_tars = [deb.package(arch, distro, "libatomic1")]

for mode in DEBUG_MODE:
for user in USERS:
oci_image(
Expand All @@ -50,7 +58,7 @@ def nodejs_image(distro, major_version, arch):
entrypoint = ["/nodejs/bin/node"],
tars = [
"@nodejs" + major_version + "_" + arch,
],
] + extra_tars,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we kind of moved away from this style, but I'll change it in a followup.

)

_check_certificates_tar()
Expand Down
6 changes: 6 additions & 0 deletions nodejs/testdata/nodejs26.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
schemaVersion: "2.0.0"
commandTests:
- name: nodejs
command: "/nodejs/bin/node"
args: ["--version"]
expectedOutput: ["v26.1.0"]
44 changes: 44 additions & 0 deletions private/extensions/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,46 @@ def _node_impl(module_ctx):
control = "//nodejs:control",
)

node_archive(
name = "nodejs26_amd64",
sha256 = "62d555c329e05e3625109f2e3a8b5195b368d5ef38266292469d32f63cd98ffd",
strip_prefix = "node-v26.1.0-linux-x64/",
urls = ["https://nodejs.org/dist/v26.1.0/node-v26.1.0-linux-x64.tar.gz"],
version = "26.1.0",
architecture = "amd64",
control = "//nodejs:control",
)

node_archive(
name = "nodejs26_arm64",
sha256 = "fcb4c339eef70c909cae72091008a6497278e2d0fcd221c0653068cf4ea4f0c7",
strip_prefix = "node-v26.1.0-linux-arm64/",
urls = ["https://nodejs.org/dist/v26.1.0/node-v26.1.0-linux-arm64.tar.gz"],
version = "26.1.0",
architecture = "arm64",
control = "//nodejs:control",
)

node_archive(
name = "nodejs26_ppc64le",
sha256 = "f3ee72a29d3d25a626bae1672667a500b12c284fcfc00f5d6162e3762ebf173f",
strip_prefix = "node-v26.1.0-linux-ppc64le/",
urls = ["https://nodejs.org/dist/v26.1.0/node-v26.1.0-linux-ppc64le.tar.gz"],
version = "26.1.0",
architecture = "ppc64le",
control = "//nodejs:control",
)

node_archive(
name = "nodejs26_s390x",
sha256 = "6e381e4a3b353f335d297abfe4c7d9485459247519df10445b17cc89d8c7f7a5",
strip_prefix = "node-v26.1.0-linux-s390x/",
urls = ["https://nodejs.org/dist/v26.1.0/node-v26.1.0-linux-s390x.tar.gz"],
version = "26.1.0",
architecture = "s390x",
control = "//nodejs:control",
)
Comment on lines +192 to +230
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and reduce code duplication, you could define the version and architecture-specific details in a map and loop over it to generate these node_archive calls. This would make it easier to update in the future.

For example:

NODE26_VERSION = "26.1.0"
NODE26_ARCHS = {
    "amd64": ("x64", "62d555c329e05e3625109f2e3a8b5195b368d5ef38266292469d32f63cd98ffd"),
    "arm64": ("arm64", "fcb4c339eef70c909cae72091008a6497278e2d0fcd221c0653068cf4ea4f0c7"),
    "ppc64le": ("ppc64le", "f3ee72a29d3d25a626bae1672667a500b12c284fcfc00f5d6162e3762ebf173f"),
    "s390x": ("s390x", "6e381e4a3b353f335d297abfe4c7d9485459247519df10445b17cc89d8c7f7a5"),
}

for arch, (platform, sha) in NODE26_ARCHS.items():
    node_archive(
        name = "nodejs26_" + arch,
        sha256 = sha,
        strip_prefix = "node-v{v}-linux-{p}/".format(v=NODE26_VERSION, p=platform),
        urls = ["https://nodejs.org/dist/v{v}/node-v{v}-linux-{p}.tar.gz".format(v=NODE26_VERSION, p=platform)],
        version = NODE26_VERSION,
        architecture = arch,
        control = "//nodejs:control",
    )

While this would be a good improvement, it would be even better to apply this pattern to the definitions for Node.js 22 and 24 as well for consistency, which could be done in a follow-up change.


return module_ctx.extension_metadata(
root_module_direct_deps = [
"nodejs22_amd64",
Expand All @@ -200,6 +240,10 @@ def _node_impl(module_ctx):
"nodejs24_arm64",
"nodejs24_ppc64le",
"nodejs24_s390x",
"nodejs26_amd64",
"nodejs26_arm64",
"nodejs26_ppc64le",
"nodejs26_s390x",
],
root_module_direct_dev_deps = [],
)
Expand Down
66 changes: 66 additions & 0 deletions private/repos/deb/trixie.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@
],
"version": "14.2.0-19"
},
{
"arch": "amd64",
"dependencies": [],
"key": "libatomic1_14.2.0-19_amd64",
"name": "libatomic1",
"sha256": "212b399aae2f7299203d261a57e49372e09565a9a5ea971905f94a3960366c05",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_amd64.deb"
],
"version": "14.2.0-19"
},
{
"arch": "arm64",
"dependencies": [],
Expand Down Expand Up @@ -352,6 +363,17 @@
],
"version": "14.2.0-19"
},
{
"arch": "arm64",
"dependencies": [],
"key": "libatomic1_14.2.0-19_arm64",
"name": "libatomic1",
"sha256": "7ccff90234484bf21ae5ecb79d25b6a84b2f4038f65dd139085b2e3a937cd8dc",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_arm64.deb"
],
"version": "14.2.0-19"
},
{
"arch": "armhf",
"dependencies": [],
Expand Down Expand Up @@ -528,6 +550,17 @@
],
"version": "14.2.0-19"
},
{
"arch": "armhf",
"dependencies": [],
"key": "libatomic1_14.2.0-19_armhf",
"name": "libatomic1",
"sha256": "e4a4dc17913ded43f2a8571f9c8c214d05534632fc5a41705d6b39acd8d5f4a4",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_armhf.deb"
],
"version": "14.2.0-19"
},
{
"arch": "s390x",
"dependencies": [],
Expand Down Expand Up @@ -704,6 +737,17 @@
],
"version": "14.2.0-19"
},
{
"arch": "s390x",
"dependencies": [],
"key": "libatomic1_14.2.0-19_s390x",
"name": "libatomic1",
"sha256": "79ce585c987c08702360d5d973fa6f4c596a5c4802d7e3f06294b46f03b0456a",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_s390x.deb"
],
"version": "14.2.0-19"
},
{
"arch": "ppc64el",
"dependencies": [],
Expand Down Expand Up @@ -880,6 +924,17 @@
],
"version": "14.2.0-19"
},
{
"arch": "ppc64el",
"dependencies": [],
"key": "libatomic1_14.2.0-19_ppc64el",
"name": "libatomic1",
"sha256": "fd421018c73e8f5a2628f233ff1d277d1ebf797b9e204a59e34ed6072167544a",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_ppc64el.deb"
],
"version": "14.2.0-19"
},
{
"arch": "riscv64",
"dependencies": [],
Expand Down Expand Up @@ -1055,6 +1110,17 @@
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libstdc++6_14.2.0-19_riscv64.deb"
],
"version": "14.2.0-19"
},
{
"arch": "riscv64",
"dependencies": [],
"key": "libatomic1_14.2.0-19_riscv64",
"name": "libatomic1",
"sha256": "ebaf12b2de00a4b567f70c629c0ff744dc92491029b3219d59c05c733f200c65",
"urls": [
"https://snapshot.debian.org/archive/debian/20260510T204219Z/pool/main/g/gcc-14/libatomic1_14.2.0-19_riscv64.deb"
],
"version": "14.2.0-19"
}
],
"version": 1
Expand Down
2 changes: 2 additions & 0 deletions private/repos/deb/trixie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ packages:
- libgcc-s1
- libgomp1
- libstdc++6
# node26
- libatomic1
Loading