From ed29a6c29b93993901ada96062c54d55b653fd60 Mon Sep 17 00:00:00 2001 From: huhn511 Date: Sun, 7 Jun 2026 21:31:10 +0200 Subject: [PATCH] fix: guarantee Next's native swc binary in the prod Docker build npm ci intermittently omits the platform-optional @next/swc-linux-*-gnu native dep even when it's correctly in the lockfile (npm/cli #4828). Next 16's Turbopack has no WASM fallback, so a missing binary aborts the build. Force-install the arch-matching binary after npm ci so the build no longer depends on npm-ci luck. Same fix already shipped in shell v0.2.2. Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 46f1b79..2f16af7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,16 @@ RUN --mount=type=secret,id=node_auth_token \ NODE_AUTH_TOKEN="$(cat /run/secrets/node_auth_token 2>/dev/null || true)" \ npm ci --no-audit --no-fund +# Guarantee Next's native swc binary. `npm ci` intermittently omits a +# platform-optional native dep even when it's correctly in the lockfile +# (npm/cli #4828) — and Next 16's Turbopack has NO WASM fallback, so a missing +# binary aborts the build ("Turbopack is not supported on this platform"). We +# force-install the binary matching the build platform's arch + the resolved +# next version (process.arch is "x64"/"arm64", matching the package names) so the +# build never depends on npm-ci luck. It's a public package (no GHCR auth), and +# `--no-save` leaves package.json/lock untouched. +RUN npm install --no-save "@next/swc-linux-$(node -p process.arch)-gnu@$(node -p "require('next/package.json').version")" + COPY . . RUN mkdir -p public