From c30ccd775b187747eab5639be103f8315953b27f Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Mon, 17 Aug 2026 17:40:58 +0800 Subject: [PATCH] fix(deploy): stop the staging web image from racing two copies of skills/ Next's output file tracing pulls skills/ into .next/standalone with symlinks resolved into real directories. The final stage copies the standalone bundle into /app first, so the later explicit `COPY skills /app/skills` tries to put the tracked symlink skills/jyotish-vedic-astrology/assets -> ../../assets on top of a real directory. Whether that is fatal depends on the BuildKit snapshotter: GitHub's runners tolerate it, Docker 29.1.3 with containerd-overlayfs refuses with "cannot replace to directory ... with file". Dropping the traced copy after the build lets the explicit COPY own that tree deterministically. /app/assets still comes from the standalone bundle, which outputFileTracingIncludes guarantees, so the symlink resolves. Verified by building the image and inspecting it: skills/ complete at 1208 files, assets still a symlink that resolves, container boots on Next.js 16.3.1 and serves / with HTTP 200. Reproduced the original failure on the pre-upgrade commit too, so it predates the Next 16.3.1 upgrade. Co-authored-by: Cursor --- deploy/railway-web.Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy/railway-web.Dockerfile b/deploy/railway-web.Dockerfile index 26a7bc2b..ff8681fd 100644 --- a/deploy/railway-web.Dockerfile +++ b/deploy/railway-web.Dockerfile @@ -25,6 +25,10 @@ COPY skills /app/skills RUN npm run build +# File tracing pulls skills/ into the standalone bundle with symlinks resolved into +# real directories, which then collides with the explicit COPY in the final stage. +RUN rm -rf /app/frontend/.next/standalone/skills + FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/node:22-alpine WORKDIR /app/frontend