mirror of
https://github.com/n8n-io/n8n.git
synced 2026-12-04 00:30:34 +00:00
build: Decouple compiled Node images from OS base refreshes (no-changelog) (#44936)
This commit is contained in:
1 parent
410013cd23
commit
ab0a94afe4
11 files changed
+131
-164
No files matched your search
@@ -23,6 +23,10 @@
|
||||
!docker/images
|
||||
!docker/images/n8n
|
||||
!docker/images/n8n/docker-entrypoint.sh
|
||||
!docker/images/node-pc
|
||||
!docker/images/node-pc/check-v8-patches.js
|
||||
!docker/images/node-pc/patches
|
||||
!docker/images/node-pc/patches/**
|
||||
!docker/images/runners
|
||||
!docker/images/runners/n8n-task-runners.json
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ These only run if specific files changed:
|
||||
| `packages/frontend/@n8n/storybook/**`, design-system, chat | `release-storybook.yml` | master |
|
||||
| `docs/backend/**`, `packages/@n8n/backend-docs-site/**` | `release-docs-backend.yml` (PR preview, master deploys to n8n-backend-docs.pages.dev) | master |
|
||||
| `docker/docker-bake.hcl`, `docker/images/n8n-base/Dockerfile`, `docker/images/n8n-base/Dockerfile.debian`, `.github/scripts/docker/base-debian-smoke-check.mjs`, `.github/scripts/docker/bake-inputs-changed.mjs` | `build-base-image.yml` (builds only the bases whose inputs changed; publishes on master only) | any |
|
||||
| `docker/docker-bake.hcl`, `docker/images/node-pc/**`, `.github/scripts/docker/bake-inputs-changed.mjs` | `build-node-pc-image.yml` (builds pointer-compressed Node 26 as `n8nio/node-pc` and stock-configured Node 24 and 26 as `n8nio/node-patched` only when their own inputs changed; publishes from master only; a `workflow_dispatch` on master with `push: true` always builds and publishes all three variants) | any |
|
||||
| `docker/docker-bake.hcl`, `docker/images/node-pc/**`, `.github/scripts/docker/bake-inputs-changed.mjs` | `build-node-pc-image.yml` (builds compiled `-dev` images for pointer-compressed Node 26 as `n8nio/node-pc` and stock-configured Node 24 and 26 as `n8nio/node-patched` only when their own inputs changed; independent of `RUNTIME_IMAGE`; publishes from master only; a `workflow_dispatch` on master with `push: true` always builds and publishes all three variants) | any |
|
||||
| `**/package.json`, `**/turbo.json` | `build-windows.yml` | master |
|
||||
| `packages/@n8n/ai-workflow-builder.ee/evaluations/programmatic/python/**` | `test-evals-python.yml` | any |
|
||||
| `packages/quality/efficiency/scale/benchmark/**` | `build-benchmark-image.yml` | master |
|
||||
|
||||
@@ -103,15 +103,13 @@ ${render(manifestStep.run, values)}`,
|
||||
|
||||
describe('Node source image manifests', () => {
|
||||
for (const repository of repositories) {
|
||||
for (const stage of ['', '-dev']) {
|
||||
for (const arch of ['amd64', 'arm64']) {
|
||||
const missingImage = `${repository}:26.13.0-commit-100-2${stage}-${arch}`;
|
||||
it(`keeps all tags unchanged when ${missingImage} is missing`, () => {
|
||||
const result = publish({ missingImage });
|
||||
assert.notEqual(result.status, 0, result.stderr);
|
||||
assert.doesNotMatch(result.stdout, /^create /m);
|
||||
});
|
||||
}
|
||||
for (const arch of ['amd64', 'arm64']) {
|
||||
const missingImage = `${repository}:26.13.0-commit-100-2-dev-${arch}`;
|
||||
it(`keeps all tags unchanged when ${missingImage} is missing`, () => {
|
||||
const result = publish({ missingImage });
|
||||
assert.notEqual(result.status, 0, result.stderr);
|
||||
assert.doesNotMatch(result.stdout, /^create /m);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,33 +117,29 @@ describe('Node source image manifests', () => {
|
||||
['run', { 'github.run_id': '99' }],
|
||||
['attempt', { 'github.run_attempt': '1' }],
|
||||
]) {
|
||||
for (const stage of ['runtime', 'dev']) {
|
||||
for (const arch of ['amd64', 'arm64']) {
|
||||
it(`keeps all tags unchanged after a failed ${stage} ${arch} rebuild with prior ${name} images`, () => {
|
||||
const result = publish({ previousExecution, failedBuild: { stage, arch } });
|
||||
assert.notEqual(result.status, 0, result.stderr);
|
||||
assert.doesNotMatch(result.stdout, /^create /m);
|
||||
});
|
||||
}
|
||||
for (const arch of ['amd64', 'arm64']) {
|
||||
it(`keeps all tags unchanged after a failed dev ${arch} rebuild with prior ${name} images`, () => {
|
||||
const result = publish({ previousExecution, failedBuild: { stage: 'dev', arch } });
|
||||
assert.notEqual(result.status, 0, result.stderr);
|
||||
assert.doesNotMatch(result.stdout, /^create /m);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
it('publishes runtime and dev tags in both registries when all images exist', () => {
|
||||
it('publishes dev tags in both registries when all images exist', () => {
|
||||
const result = publish({ previousExecution: { 'github.run_attempt': '1' } });
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
const sources = result.stdout.split('\n').filter((line) => line.startsWith('source '));
|
||||
assert.equal(sources.length, 16);
|
||||
assert.equal(sources.length, 8);
|
||||
for (const source of sources) assert.match(source, / current$/);
|
||||
const createdTags = result.stdout
|
||||
.split('\n')
|
||||
.filter((line) => line.startsWith('create '))
|
||||
.map((line) => line.slice('create '.length));
|
||||
const expectedTags = repositories.flatMap((repository) =>
|
||||
['', '-dev'].flatMap((stage) => [
|
||||
`${repository}:26.13.0${stage}`,
|
||||
`${repository}:26.13.0-commit${stage}`,
|
||||
]),
|
||||
);
|
||||
const expectedTags = repositories.flatMap((repository) => [
|
||||
`${repository}:26.13.0-dev`,
|
||||
`${repository}:26.13.0-commit-dev`,
|
||||
]);
|
||||
assert.deepEqual(createdTags.sort(), expectedTags.sort());
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,12 @@
|
||||
name: 'Build: Node PC Image'
|
||||
|
||||
# Publishes the Node runtimes that n8n compiles from source:
|
||||
# Publishes the compiled Node `-dev` images that n8n builds from source:
|
||||
# n8nio/node-pc - pointer-compressed Node 26, consumed by the n8n `-pc`
|
||||
# image variant
|
||||
# n8nio/node-patched - stock-configured Node 24 and 26 with the same V8
|
||||
# patches, for the 1.x and release images
|
||||
# The n8n image compiles native addons in these images and copies their compiled
|
||||
# Node onto n8nio/base, so OS base refreshes do not recompile Node.
|
||||
# Compiling Node from source is too slow under QEMU, so each architecture
|
||||
# builds on its native runner and a manifest job stitches the per-arch images,
|
||||
# following docker-build-push.yml.
|
||||
@@ -148,28 +150,6 @@ jobs:
|
||||
dockerhub-username: ${{ secrets.DOCKER_USERNAME }}
|
||||
dockerhub-password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push runtime target
|
||||
uses: useblacksmith/build-push-action@30c71162f16ea2c27c3e21523255d209b8b538c1 # v2
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/images/node-pc/Dockerfile
|
||||
target: runtime
|
||||
platforms: ${{ matrix.platform.name }}
|
||||
build-args: ${{ env.BUILD_ARGS }}
|
||||
provenance: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true) }}
|
||||
sbom: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true) }}
|
||||
push: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true) }}
|
||||
tags: |
|
||||
${{ secrets.DOCKER_USERNAME }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ matrix.platform.arch }}
|
||||
${{ secrets.DOCKER_USERNAME }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ github.sha }}-${{ matrix.platform.arch }}
|
||||
${{ secrets.DOCKER_USERNAME }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ env.STAGING_TAG }}-${{ matrix.platform.arch }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ matrix.platform.arch }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ github.sha }}-${{ matrix.platform.arch }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ env.STAGING_TAG }}-${{ matrix.platform.arch }}
|
||||
no-cache: true
|
||||
|
||||
# No no-cache here: reuses the compile layers from the runtime build
|
||||
# above, so Node compiles once per architecture
|
||||
- name: Build and push dev target
|
||||
uses: useblacksmith/build-push-action@30c71162f16ea2c27c3e21523255d209b8b538c1 # v2
|
||||
with:
|
||||
@@ -188,8 +168,9 @@ jobs:
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-dev-${{ matrix.platform.arch }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ github.sha }}-dev-${{ matrix.platform.arch }}
|
||||
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ env.NODE_VERSION }}-${{ env.STAGING_TAG }}-dev-${{ matrix.platform.arch }}
|
||||
no-cache: true
|
||||
|
||||
# Each image checks all runtime and dev inputs from this run and attempt.
|
||||
# Each image checks both architecture inputs from this run and attempt.
|
||||
# A failed build for another image does not block publication.
|
||||
create-multi-arch-manifest:
|
||||
needs: [prepare, build]
|
||||
@@ -219,24 +200,19 @@ jobs:
|
||||
"${{ secrets.DOCKER_USERNAME }}/${{ matrix.image.repo }}"
|
||||
"ghcr.io/${{ github.repository_owner }}/${{ matrix.image.repo }}"
|
||||
)
|
||||
# A dev build can fail after it pushed the runtime image.
|
||||
for REPO in "${REPOS[@]}"; do
|
||||
for DEV in "" "-dev"; do
|
||||
for ARCH in amd64 arm64; do
|
||||
docker buildx imagetools inspect "$REPO:$NODE_VERSION-$STAGING_TAG$DEV-$ARCH" > /dev/null
|
||||
done
|
||||
for ARCH in amd64 arm64; do
|
||||
docker buildx imagetools inspect "$REPO:$NODE_VERSION-$STAGING_TAG-dev-$ARCH" > /dev/null
|
||||
done
|
||||
done
|
||||
for REPO in "${REPOS[@]}"; do
|
||||
for DEV in "" "-dev"; do
|
||||
AMD64="$REPO:$NODE_VERSION-$STAGING_TAG$DEV-amd64"
|
||||
ARM64="$REPO:$NODE_VERSION-$STAGING_TAG$DEV-arm64"
|
||||
for TAG in \
|
||||
"$REPO:$NODE_VERSION$DEV" \
|
||||
"$REPO:$NODE_VERSION-${{ github.sha }}$DEV" \
|
||||
; do
|
||||
echo "Creating manifest $TAG"
|
||||
docker buildx imagetools create --tag "$TAG" "$AMD64" "$ARM64"
|
||||
done
|
||||
AMD64="$REPO:$NODE_VERSION-$STAGING_TAG-dev-amd64"
|
||||
ARM64="$REPO:$NODE_VERSION-$STAGING_TAG-dev-arm64"
|
||||
for TAG in \
|
||||
"$REPO:$NODE_VERSION-dev" \
|
||||
"$REPO:$NODE_VERSION-${{ github.sha }}-dev" \
|
||||
; do
|
||||
echo "Creating manifest $TAG"
|
||||
docker buildx imagetools create --tag "$TAG" "$AMD64" "$ARM64"
|
||||
done
|
||||
done
|
||||
@@ -144,6 +144,18 @@ jobs:
|
||||
GH_TOKEN: ${{ steps.cloud-token.outputs.token }}
|
||||
run: pnpm build:docker:smoke
|
||||
|
||||
# Also verify the pointer-compressed n8n image on the same compiled
|
||||
# artifact and base image, so PC_BUILDER_IMAGE and RUNTIME_IMAGE changes
|
||||
# are smoke-tested on amd64 and arm64 before merge.
|
||||
- name: Build and verify the pointer-compressed n8n image
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.cloud-token.outputs.token }}
|
||||
SMOKE_IMAGE: n8nio/n8n:local-pc
|
||||
SMOKE_RUNNERS_IMAGES: ''
|
||||
run: |
|
||||
docker buildx bake -f docker/docker-bake.hcl n8n-pc --no-cache --provenance=false --load
|
||||
pnpm build:docker:smoke
|
||||
|
||||
# n8n-cloud does not deploy the Debian images, so skip the chart patterns.
|
||||
- name: Verify the Debian n8n and runners images
|
||||
env:
|
||||
|
||||
+23
-33
@@ -32,60 +32,50 @@ and release branches. On a branch without a bake file, the pin PR edits the
|
||||
|---|---|
|
||||
| `RUNTIME_IMAGE` | `n8nio/base:<version>-<commit>` |
|
||||
| `DEBIAN_RUNTIME_IMAGE` | `n8nio/base:<version>-debian-<commit>` |
|
||||
| `N8N_RUNTIME_IMAGE` | `n8nio/node-patched:<version>-<commit>` |
|
||||
| `N8N_BUILDER_IMAGE` | `n8nio/node-patched:<version>-<commit>-dev` |
|
||||
| `PC_RUNTIME_IMAGE` | `n8nio/node-pc:<version>-<commit>` |
|
||||
| `PC_BUILDER_IMAGE` | `n8nio/node-pc:<version>-<commit>-dev` |
|
||||
| `NODE_24_RUNTIME_IMAGE` | `n8nio/base:<Node 24 version>-<commit>` |
|
||||
| `RUNTIME_IMAGE` (`1.x` Dockerfile, after the switch) | `n8nio/node-patched:<Node 24 version>-<commit>` |
|
||||
| `BUILDER_IMAGE` (`1.x` Dockerfile, after the switch) | `n8nio/node-patched:<Node 24 version>-<commit>-dev` |
|
||||
| `RUNTIME_IMAGE` (Node 26 release branch) | `n8nio/node-patched:<version>-<commit>` |
|
||||
| `BUILDER_IMAGE` (Node 26 release branch) | `n8nio/node-patched:<version>-<commit>-dev` |
|
||||
| `RUNTIME_IMAGE` (`1.x` Dockerfile) | `n8nio/base:<Node 24 version>-<commit>` |
|
||||
| `BUILDER_IMAGE` (`1.x` Dockerfile) | `n8nio/node-patched:<Node 24 version>-<commit>-dev` |
|
||||
|
||||
Before the switch, the `1.x` Dockerfile pins `RUNTIME_IMAGE` to `n8nio/base`
|
||||
and `BUILDER_IMAGE` to the official `node` image. After master publishes the
|
||||
patched Node 24 images, change both pins to `n8nio/node-patched`. Keep
|
||||
`NODE_24_RUNTIME_IMAGE` on the master-published `n8nio/base` Node 24 image.
|
||||
Do not copy the new `1.x` runtime pin into this input.
|
||||
The `n8n` and `n8n-pc` Dockerfiles build on `RUNTIME_IMAGE` (`n8nio/base`) and
|
||||
copy the compiled Node binaries from their `*-dev` builder image. OS base
|
||||
refreshes therefore pin `RUNTIME_IMAGE` only and do not recompile Node.
|
||||
|
||||
| Image | Inputs (PR 1) | Pins (PR 2) |
|
||||
|---|---|---|
|
||||
| `n8nio/base` | `DHI_REF`, `n8n-base/Dockerfile` | `RUNTIME_IMAGE` |
|
||||
| `n8nio/base:*-debian` | `DEBIAN_DHI_REF`, `ALPINE_IMAGE`, `n8n-base/Dockerfile.debian` | `DEBIAN_RUNTIME_IMAGE` |
|
||||
| `n8nio/node-pc` | `NODE_VERSION`, `RUNTIME_IMAGE`, `ALPINE_IMAGE`, `node-pc/Dockerfile`, `node-pc/patches/*`, `node-pc/check-v8-patches.js` | `PC_BUILDER_IMAGE`, `PC_RUNTIME_IMAGE` |
|
||||
| `n8nio/node-patched` (Node 24) | `NODE_24_VERSION`, `NODE_24_RUNTIME_IMAGE`, `ALPINE_IMAGE`, and the `node-pc` files | `BUILDER_IMAGE`, `RUNTIME_IMAGE` in `docker/images/n8n/Dockerfile` on the `1.x` branch |
|
||||
| `n8nio/node-patched` (Node 26) | `NODE_VERSION`, `RUNTIME_IMAGE`, `ALPINE_IMAGE`, and the `node-pc` files | `BUILDER_IMAGE`, `RUNTIME_IMAGE` on the Node 26 release branches |
|
||||
| `n8nio/node-pc` | `NODE_VERSION`, `ALPINE_IMAGE`, `node-pc/Dockerfile`, `node-pc/patches/*`, `node-pc/check-v8-patches.js` | `PC_BUILDER_IMAGE` |
|
||||
| `n8nio/node-patched` (Node 24) | `NODE_24_VERSION`, `ALPINE_IMAGE`, and the `node-pc` files | `BUILDER_IMAGE` in `docker/images/n8n/Dockerfile` on the `1.x` branch |
|
||||
| `n8nio/node-patched` (Node 26) | `NODE_VERSION`, `ALPINE_IMAGE`, and the `node-pc` files | `N8N_BUILDER_IMAGE` |
|
||||
|
||||
- A push to master publishes an image only when its inputs changed. A pin PR
|
||||
changes no input of the image that it pins, so the tag stays on the pin.
|
||||
- `RUNTIME_IMAGE` is an input of `n8nio/node-pc`. So the pin PR of a new base
|
||||
is the inputs PR of node-pc, and the `-pc` images need a third PR.
|
||||
- `n8nio/node-pc` and `n8nio/node-patched` do not depend on `RUNTIME_IMAGE`.
|
||||
A base image refresh takes two PRs (`DHI_REF` → `RUNTIME_IMAGE`) and does
|
||||
not trigger `build-node-pc-image.yml`.
|
||||
- Only master publishes. The workflows stop a dispatch with `push` on another
|
||||
branch.
|
||||
- A dispatch on master with `push` always publishes. Use it when a publish run
|
||||
failed, when only the workflow changed, or to get patched OS packages. Then
|
||||
pin the new digest.
|
||||
|
||||
The `node-patched-26` target uses the same Node version and runtime base as
|
||||
`node-pc`, with pointer compression off. The workflow publishes runtime and
|
||||
`-dev` tags for Node 24 and Node 26. It builds each variant on native amd64
|
||||
and arm64 runners and creates a multi-arch manifest for each tag. After master
|
||||
publishes, pin the Node 26 runtime and `-dev` digests on the branches selected
|
||||
for stable and beta releases.
|
||||
The `node-patched-26` target uses the same Node version as `node-pc`, with
|
||||
pointer compression off. The workflow publishes `-dev` tags for Node 24 and
|
||||
Node 26. It builds each variant on native amd64 and arm64 runners and creates
|
||||
a multi-arch manifest for each tag.
|
||||
|
||||
### Example: a new Node version
|
||||
|
||||
1. Change `DHI_REF` and `DEBIAN_DHI_REF`. Master publishes the new bases.
|
||||
2. Change `NODE_VERSION`, `BUILDER_IMAGE` and `DEBIAN_BUILDER_IMAGE`. Pin
|
||||
`RUNTIME_IMAGE` and `DEBIAN_RUNTIME_IMAGE`. Master publishes `node-pc`
|
||||
and `node-patched-26` from these inputs.
|
||||
3. Pin `PC_BUILDER_IMAGE` and `PC_RUNTIME_IMAGE`. Pin the Node 26
|
||||
`n8nio/node-patched` runtime and `-dev` digests in the release branches.
|
||||
1. Change `DHI_REF`, `DEBIAN_DHI_REF`, `NODE_VERSION`, `BUILDER_IMAGE`, and
|
||||
`DEBIAN_BUILDER_IMAGE`. Master publishes the new bases (`n8nio/base`),
|
||||
`n8nio/node-pc:*-dev`, and `n8nio/node-patched:*-dev`.
|
||||
2. Pin `RUNTIME_IMAGE`, `DEBIAN_RUNTIME_IMAGE`, `N8N_BUILDER_IMAGE`, and
|
||||
`PC_BUILDER_IMAGE`.
|
||||
|
||||
For a Node 24 update, change `NODE_24_DHI_REF` first. After master publishes
|
||||
the base, pin it in `NODE_24_RUNTIME_IMAGE` and change `NODE_24_VERSION`.
|
||||
After master publishes `node-patched-24`, pin its runtime and `-dev` digests
|
||||
in the `1.x` Dockerfile.
|
||||
For a Node 24 update, change `NODE_24_DHI_REF` and `NODE_24_VERSION`. After
|
||||
master publishes `n8nio/base` and `n8nio/node-patched:*-dev`, pin
|
||||
`RUNTIME_IMAGE` and `BUILDER_IMAGE` in the `1.x` Dockerfile.
|
||||
|
||||
Other third-party pins (`node`, `python`, `alpine`, distroless) change in one
|
||||
PR.
|
||||
+17
-29
@@ -8,7 +8,7 @@
|
||||
variable "NODE_VERSION" { default = "26.13.0" }
|
||||
|
||||
# n8nio/base builds on these. The tag of each base is the Node version of its
|
||||
# DHI ref. The Node 24 base also supplies the node-patched-24 runtime.
|
||||
# DHI ref. The Node 24 base supplies the 1.x runtime image.
|
||||
variable "DHI_REF" {
|
||||
default = "dhi.io/node:26.13.0-alpine3.24-dev@sha256:3e61a81f5d83780aff01cb2d8f2251698bf3fe7d522bef71a9656fa93333b504"
|
||||
}
|
||||
@@ -37,30 +37,18 @@ variable "DEBIAN_RUNTIME_IMAGE" {
|
||||
default = "n8nio/base:26.13.0-debian-b23a3454e958998b052277c130ee6f9f027427f0@sha256:cbdcf28cd718a9a3c8490cd2ee80dd61869e19e3a663ab0f7b762eb5e7ee2f4a"
|
||||
}
|
||||
|
||||
# Published by build-node-pc-image.yml on master.
|
||||
# Published by build-node-pc-image.yml on master. The n8n image compiles native
|
||||
# addons in these images and copies their compiled Node onto RUNTIME_IMAGE.
|
||||
variable "N8N_BUILDER_IMAGE" {
|
||||
default = "n8nio/node-patched:26.13.0-6484e2d8092f46c7ce7a4fbd97847ba3cb539e72-dev@sha256:2bb25015cc92814809410aaab21ad5696a901a2f58c9bce6ed5faeafe4fd5f15"
|
||||
}
|
||||
variable "N8N_RUNTIME_IMAGE" {
|
||||
default = "n8nio/node-patched:26.13.0-6484e2d8092f46c7ce7a4fbd97847ba3cb539e72@sha256:c1ae64f56f1e54ef84bcd9e6205a8d167a929ae1e0f057bc6b8949ccdaa2212c"
|
||||
}
|
||||
|
||||
# Published by build-node-pc-image.yml on master.
|
||||
variable "PC_BUILDER_IMAGE" {
|
||||
default = "n8nio/node-pc:26.13.0-c191db3de7f8187af3f35a59c2a1ca6833c66afc-dev@sha256:c1ff9dd826920453d5ab67cb3daaa4b3efb5270cf45d65b7f393bee7c4ff1857"
|
||||
}
|
||||
variable "PC_RUNTIME_IMAGE" {
|
||||
default = "n8nio/node-pc:26.13.0-c191db3de7f8187af3f35a59c2a1ca6833c66afc@sha256:757a7ca4022a4a2aebdc6e1f07e9d08016e446994aed1c8473922df54a14eb01"
|
||||
}
|
||||
|
||||
# Inputs of n8nio/node-patched for the 1.x image. NODE_24_RUNTIME_IMAGE pins
|
||||
# the Node 24 base that master published. Keep this input on n8nio/base after
|
||||
# the 1.x Dockerfile switches its RUNTIME_IMAGE to n8nio/node-patched.
|
||||
# Input of n8nio/node-patched for the 1.x image.
|
||||
# build-node-pc-image.yml publishes node-patched on master.
|
||||
variable "NODE_24_VERSION" { default = "24.22.3" }
|
||||
variable "NODE_24_RUNTIME_IMAGE" {
|
||||
default = "n8nio/base:24.22.1-c4188d049e9d3b3e9ed6337439fa1cb134979925@sha256:711f03f1f2cfaa3bc0bc65bdf9dbd0cd929d8e4620fcdb5729b53b51d85578f2"
|
||||
}
|
||||
|
||||
# Other base images. The runners take their Python version from the image tag.
|
||||
variable "ALPINE_IMAGE" {
|
||||
@@ -134,8 +122,9 @@ target "n8n" {
|
||||
dockerfile = "docker/images/n8n/Dockerfile"
|
||||
tags = tags(N8N_TAGS, "${IMAGE_BASE_NAME}:${IMAGE_TAG}")
|
||||
args = {
|
||||
BUILDER_IMAGE = N8N_BUILDER_IMAGE
|
||||
RUNTIME_IMAGE = N8N_RUNTIME_IMAGE
|
||||
BUILDER_IMAGE = N8N_BUILDER_IMAGE
|
||||
RUNTIME_IMAGE = RUNTIME_IMAGE
|
||||
ENABLE_POINTER_COMPRESSION = "false"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +132,9 @@ target "n8n-pc" {
|
||||
inherits = ["n8n"]
|
||||
tags = tags(N8N_PC_TAGS, "${IMAGE_BASE_NAME}:${IMAGE_TAG}-pc")
|
||||
args = {
|
||||
BUILDER_IMAGE = PC_BUILDER_IMAGE
|
||||
RUNTIME_IMAGE = PC_RUNTIME_IMAGE
|
||||
IMAGE_DESCRIPTION = "Workflow Automation Tool (pointer-compressed variant, internal to n8n Cloud, no support or stability guarantees)"
|
||||
BUILDER_IMAGE = PC_BUILDER_IMAGE
|
||||
ENABLE_POINTER_COMPRESSION = "true"
|
||||
IMAGE_DESCRIPTION = "Workflow Automation Tool (pointer-compressed variant, internal to n8n Cloud, no support or stability guarantees)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,19 +216,19 @@ target "base-node-24" {
|
||||
tags = ["n8nio/base:${dhi_node_version(NODE_24_DHI_REF)}"]
|
||||
}
|
||||
|
||||
# build-node-pc-image.yml builds the runtime and dev stages of all Node
|
||||
# source builds and sets the tags.
|
||||
# build-node-pc-image.yml builds the dev stage of all Node source builds and
|
||||
# sets the tags. None of these depend on RUNTIME_IMAGE, so OS base refreshes
|
||||
# do not recompile Node.
|
||||
target "node-pc" {
|
||||
inherits = ["_context"]
|
||||
dockerfile = "docker/images/node-pc/Dockerfile"
|
||||
target = "runtime"
|
||||
target = "dev"
|
||||
args = {
|
||||
NODE_VERSION = NODE_VERSION
|
||||
ALPINE_IMAGE = ALPINE_IMAGE
|
||||
RUNTIME_IMAGE = RUNTIME_IMAGE
|
||||
ENABLE_POINTER_COMPRESSION = "true"
|
||||
}
|
||||
tags = ["n8nio/node-pc:${NODE_VERSION}"]
|
||||
tags = ["n8nio/node-pc:${NODE_VERSION}-dev"]
|
||||
}
|
||||
|
||||
# Stock-configured Node 24 with the same V8 patches, for the 1.x image.
|
||||
@@ -247,10 +236,9 @@ target "node-patched-24" {
|
||||
inherits = ["node-pc"]
|
||||
args = {
|
||||
NODE_VERSION = NODE_24_VERSION
|
||||
RUNTIME_IMAGE = NODE_24_RUNTIME_IMAGE
|
||||
ENABLE_POINTER_COMPRESSION = "false"
|
||||
}
|
||||
tags = ["n8nio/node-patched:${NODE_24_VERSION}"]
|
||||
tags = ["n8nio/node-patched:${NODE_24_VERSION}-dev"]
|
||||
}
|
||||
|
||||
# Stock-configured Node 26 with the same V8 patches, for the release images.
|
||||
@@ -259,7 +247,7 @@ target "node-patched-26" {
|
||||
args = {
|
||||
ENABLE_POINTER_COMPRESSION = "false"
|
||||
}
|
||||
tags = ["n8nio/node-patched:${NODE_VERSION}"]
|
||||
tags = ["n8nio/node-patched:${NODE_VERSION}-dev"]
|
||||
}
|
||||
|
||||
group "default" { targets = ["n8n", "runners"] }
|
||||
|
||||
@@ -5,9 +5,13 @@ ARG N8N_VERSION=snapshot
|
||||
# `docker buildx bake`, not plain `docker build`.
|
||||
ARG BUILDER_IMAGE
|
||||
ARG RUNTIME_IMAGE
|
||||
ARG ENABLE_POINTER_COMPRESSION=false
|
||||
|
||||
# Clean source of our compiled Node binaries before build tools are installed.
|
||||
FROM ${BUILDER_IMAGE} AS node-source
|
||||
|
||||
# The runtime base has no compiler, so this stage supplies one.
|
||||
FROM ${BUILDER_IMAGE} AS toolchain
|
||||
FROM node-source AS toolchain
|
||||
RUN apk add --no-cache python3 make g++
|
||||
ENV NODE_GYP=/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
|
||||
|
||||
@@ -49,6 +53,21 @@ RUN BUILD_LIBRDKAFKA=0 node "$NODE_GYP" rebuild --release
|
||||
# when you change its pin in docker/docker-bake.hcl.
|
||||
FROM ${RUNTIME_IMAGE}
|
||||
|
||||
# Replace the base image's stock Node with our compiled Node from BUILDER_IMAGE.
|
||||
# Keeping this above release metadata ARGs/ENV and `COPY ./compiled` decouples
|
||||
# OS base refreshes from Node source compiles while keeping release and app-only
|
||||
# builds cached on these layers. Specific V8 patches are verified by
|
||||
# check-v8-patches.js when BUILDER_IMAGE is built; verify the binary path,
|
||||
# runtime ABI, `-n8n.N` V8 suffix, and pointer-compression flag here so a future
|
||||
# inputs PR updating check-v8-patches.js does not fail against the pinned image.
|
||||
RUN rm -f /usr/bin/node /usr/bin/nodejs /usr/bin/npm /usr/bin/npx /usr/local/bin/node
|
||||
COPY --from=node-source /usr/local/bin /usr/local/bin
|
||||
COPY --from=node-source /usr/local/lib /usr/local/lib
|
||||
ARG ENABLE_POINTER_COMPRESSION
|
||||
RUN node --version \
|
||||
&& node -e 'const want = process.env.ENABLE_POINTER_COMPRESSION === "true", got = Boolean(process.config.variables.v8_enable_pointer_compression); if (process.execPath !== "/usr/local/bin/node") throw new Error("expected /usr/local/bin/node, got " + process.execPath); if (!/-n8n\.\d+$/.test(process.versions.v8)) throw new Error("V8 " + process.versions.v8 + " has no n8n patch suffix"); if (want !== got) throw new Error("pointer compression is " + (got ? "on" : "off") + ", expected " + (want ? "on" : "off"));' \
|
||||
&& ln -sf /usr/local/bin/node /usr/bin/node
|
||||
|
||||
ARG N8N_VERSION
|
||||
ARG N8N_RELEASE_TYPE=dev
|
||||
ARG IMAGE_DESCRIPTION="Workflow Automation Tool"
|
||||
@@ -74,7 +93,7 @@ COPY --from=native-builder /build/isolated-vm/build/Release/isolated_vm.node \
|
||||
# a patch hash. The shell must expand this destination.
|
||||
COPY --from=native-builder /build/node_modules/@confluentinc/kafka-javascript/build/Release/confluent-kafka-javascript.node /tmp/
|
||||
|
||||
# The base image keeps node in /usr/bin and has no /usr/local/bin.
|
||||
# Symlink n8n into /usr/local/bin where cloud launch configs expect it.
|
||||
RUN set -e; \
|
||||
N8N=/usr/local/lib/node_modules/n8n; \
|
||||
for coder in msl mvg pcd svg url; do \
|
||||
|
||||
@@ -16,18 +16,15 @@
|
||||
# -n8n.N suffix of the V8 version, and check-v8-patches.js proves that the
|
||||
# compiled Node carries the patches and the expected configure flags.
|
||||
#
|
||||
# Two published targets per image:
|
||||
# runtime (default) - RUNTIME_IMAGE (an n8nio/base) with our compiled Node
|
||||
# swapped in
|
||||
# dev - plain Alpine with apk usable, for the n8n builder
|
||||
# stage, which must compile native addons against this
|
||||
# Node's headers
|
||||
# Publishes the `dev` target per image: plain Alpine with our compiled Node,
|
||||
# npm, and headers under /usr/local. The n8n image builds native addons in this
|
||||
# image and copies /usr/local/bin and /usr/local/lib onto n8nio/base, so OS base
|
||||
# refreshes do not recompile Node.
|
||||
#
|
||||
# The node-pc and node-patched-* targets in docker/docker-bake.hcl set these.
|
||||
# Do not use plain `docker build`.
|
||||
ARG NODE_VERSION
|
||||
ARG ALPINE_IMAGE
|
||||
ARG RUNTIME_IMAGE
|
||||
ARG ENABLE_POINTER_COMPRESSION=true
|
||||
# Compiling V8 needs 1.5-2 GB of memory per parallel job. Lower this on
|
||||
# builders whose memory-to-core ratio cannot cover all cores.
|
||||
@@ -80,7 +77,8 @@ RUN case "$ENABLE_POINTER_COMPRESSION" in true|false) ;; *) echo "ENABLE_POINTER
|
||||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
&& gpgconf --kill all \
|
||||
&& rm -rf "$GNUPGHOME" \
|
||||
# dirmngr exits asynchronously and can unlink S.dirmngr mid-rm on BusyBox.
|
||||
&& { rm -rf "$GNUPGHOME" || { sleep 1 && rm -rf "$GNUPGHOME"; }; } \
|
||||
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
||||
&& tar -xf "node-v$NODE_VERSION.tar.xz" \
|
||||
&& cd "node-v$NODE_VERSION" \
|
||||
@@ -127,21 +125,3 @@ FROM base AS dev
|
||||
# up this build's defines (e.g. pointer compression), never against downloaded
|
||||
# stock headers.
|
||||
ENV npm_config_nodedir=/usr/local
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# RUNTIME_IMAGE (an `n8nio/base`), with our compiled Node in place of the
|
||||
# stock node, npm and npx.
|
||||
FROM ${RUNTIME_IMAGE} AS runtime
|
||||
ARG ENABLE_POINTER_COMPRESSION
|
||||
|
||||
RUN rm -f /usr/bin/node /usr/bin/nodejs /usr/bin/npm /usr/bin/npx /usr/local/bin/node
|
||||
COPY --from=builder /node-install/usr/local /usr/local
|
||||
COPY docker/images/node-pc/check-v8-patches.js /tmp/check-v8-patches.js
|
||||
RUN node --version \
|
||||
&& node /tmp/check-v8-patches.js && rm /tmp/check-v8-patches.js
|
||||
|
||||
# The compiled build lives at /usr/local/bin, which is what the cloud launch
|
||||
# and AppArmor profile expect. Keep the stock /usr/bin path working for
|
||||
# anything that references it.
|
||||
RUN ln -sf /usr/local/bin/node /usr/bin/node
|
||||
@@ -210,8 +210,9 @@ async function buildWithPodman(platform) {
|
||||
dockerfile: 'docker/images/n8n/Dockerfile',
|
||||
tag: `${imageBaseName}:${imageTag}`,
|
||||
args: [
|
||||
['BUILDER_IMAGE', builderImage],
|
||||
['BUILDER_IMAGE', await bakeVariable('N8N_BUILDER_IMAGE')],
|
||||
['RUNTIME_IMAGE', await bakeVariable('RUNTIME_IMAGE')],
|
||||
['ENABLE_POINTER_COMPRESSION', 'false'],
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -15,14 +15,17 @@ const IMAGE = process.env.SMOKE_IMAGE || 'n8nio/n8n:local';
|
||||
// Runners images to exec-check. Tracks DOCKER_BUILD_DISTROLESS so the same
|
||||
// flag drives both build and check. SMOKE_RUNNERS_IMAGES (comma-separated)
|
||||
// overrides both.
|
||||
const RUNNERS_IMAGES = process.env.SMOKE_RUNNERS_IMAGES
|
||||
? process.env.SMOKE_RUNNERS_IMAGES.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
: [
|
||||
'n8nio/runners:local',
|
||||
...(process.env.DOCKER_BUILD_DISTROLESS === 'true' ? ['n8nio/runners:local-distroless'] : []),
|
||||
];
|
||||
const RUNNERS_IMAGES =
|
||||
process.env.SMOKE_RUNNERS_IMAGES !== undefined
|
||||
? process.env.SMOKE_RUNNERS_IMAGES.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
: [
|
||||
'n8nio/runners:local',
|
||||
...(process.env.DOCKER_BUILD_DISTROLESS === 'true'
|
||||
? ['n8nio/runners:local-distroless']
|
||||
: []),
|
||||
];
|
||||
const TIMEOUT = '45s';
|
||||
// Matches an n8n runtime image ref (e.g. `n8nio/n8n:2.4.4`, `ghcr.io/n8n-io/n8n@sha256:…`)
|
||||
// but not sidecars like `n8nio/runners:…` or controller images that happen to contain "n8n".
|
||||
|
||||
Reference in new issue
Block a user