c30ccd775b
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 <cursoragent@cursor.com>
50 lines
1.8 KiB
Docker
50 lines
1.8 KiB
Docker
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/node:22-alpine AS build
|
|
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/src ./src
|
|
COPY frontend/public ./public
|
|
COPY frontend/next.config.ts frontend/postcss.config.mjs frontend/tsconfig.json ./
|
|
COPY frontend/scripts ./scripts
|
|
COPY frontend/db ./db
|
|
COPY frontend/supabase/migrations ./supabase/migrations
|
|
|
|
ARG NEXT_DEPLOYMENT_ID
|
|
ARG NEXT_PUBLIC_SUPABASE_URL
|
|
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|
ENV NEXT_DEPLOYMENT_ID=${NEXT_DEPLOYMENT_ID} \
|
|
NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL} \
|
|
NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
|
COPY SKILL.md /app/SKILL.md
|
|
COPY assets /app/assets
|
|
COPY references /app/references
|
|
COPY scripts /app/scripts
|
|
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
|
|
COPY --from=build /app/frontend/.next/standalone /app
|
|
COPY --from=build /app/frontend/.next/static /app/frontend/.next/static
|
|
COPY --from=build /app/frontend/public /app/frontend/public
|
|
COPY --from=build /app/frontend/db /app/frontend/db
|
|
COPY --from=build /app/frontend/supabase/migrations /app/frontend/supabase/migrations
|
|
COPY --from=build /app/skills /app/skills
|
|
|
|
ARG NEXT_PUBLIC_SUPABASE_URL
|
|
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|
ENV NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL} \
|
|
NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
|
ENV NODE_ENV=production \
|
|
HOSTNAME=0.0.0.0 \
|
|
JYOTISHA_PROJECT_ROOT=/app
|
|
CMD ["node", "server.js"]
|