Next 16.3.1 turns on turbopackFileSystemCacheForBuild by default and keeps it in .next/cache/turbopack, inside the image build's BuildKit cache mount. Reproduced locally: a cold build ate8e358213, then a build at0bf3210c8reusing only .next/cache, lost the four .birth-place-coordinate* classes exactly as CI did. With the cache off the same rebuild carries every class; Turbopack compile time is 21.0 s either way. Recurrence of BUG-2069, whose cache-id rename only reset the cache once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
74 lines
3.4 KiB
Docker
74 lines
3.4 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 ./
|
|
# Same registry as the quality gate's own install: the build host times out on
|
|
# registry.npmjs.org (BUG-1503). The lock file pins every version and integrity
|
|
# hash, so the installed packages are identical.
|
|
ARG NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
|
|
# The download cache outlives this layer, so a lock-file change re-downloads
|
|
# only what changed. Nothing from the cache mount ends up in the image.
|
|
RUN --mount=type=cache,id=jyotisha-web-npm,target=/root/.npm npm ci --prefer-offline
|
|
|
|
COPY frontend/src ./src
|
|
COPY frontend/public ./public
|
|
# 印度占星知识 Markdown (issue #157); read by `next build`, which prerenders /learn.
|
|
COPY frontend/content ./content
|
|
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_GIT_COMMIT=${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
|
|
|
|
# Next.js build cache (webpack/SWC) across builds on the runner; it only
|
|
# speeds up compilation and never lands in the image.
|
|
# The cache id carries a version: BUG-2069 shipped the previous build's
|
|
# globals.css out of the old cache, so that cache is left behind.
|
|
# BUG-2136: the stale CSS came from Turbopack's persistent build cache
|
|
# (.next/cache/turbopack), which Next 16 turns on by default; next.config.ts
|
|
# now sets turbopackFileSystemCacheForBuild: false, so this mount no longer
|
|
# feeds compiled CSS into a build. Renaming the id (BUG-2069) only reset it once.
|
|
RUN --mount=type=cache,id=jyotisha-web-next-v2,target=/app/frontend/.next/cache npm run build
|
|
# A build that reused old CSS fails here instead of reaching a server.
|
|
RUN node scripts/check-built-css.mjs
|
|
|
|
# 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
|
|
# Live consult skill entries are git-tracked relative symlinks into /app.
|
|
COPY --from=build /app/SKILL.md /app/SKILL.md
|
|
COPY --from=build /app/assets /app/assets
|
|
COPY --from=build /app/references /app/references
|
|
COPY --from=build /app/scripts /app/scripts
|
|
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"]
|