diff --git a/docker/images/n8n/Dockerfile b/docker/images/n8n/Dockerfile index 1491473be9d..4b6a018b467 100644 --- a/docker/images/n8n/Dockerfile +++ b/docker/images/n8n/Dockerfile @@ -6,7 +6,16 @@ FROM node:${NODE_VERSION}-alpine3.22 AS builder COPY ./compiled /usr/local/lib/node_modules/n8n RUN apk add --no-cache python3 make g++ && \ cd /usr/local/lib/node_modules/n8n && \ - npm rebuild sqlite3 + npm rebuild sqlite3 && \ + # Rebuild isolated-vm from source. node-gyp-build's musl detection relies + # on /etc/alpine-release which DHI Alpine omits, so the bundled prebuilt + # loader picks the glibc binary and segfaults in musl pthread paths. + # Removing prebuilds and invoking node-gyp directly avoids npm rebuild's + # double-build behavior (built-in node-gyp + install-script node-gyp) + # which races on dep-file state. + rm -rf node_modules/isolated-vm/prebuilds && \ + cd node_modules/isolated-vm && \ + npx --yes node-gyp rebuild --release -j max FROM n8nio/base:${NODE_VERSION}