perf: add Docker build cache for Next.js
All checks were successful
Gitea CI / test-build (push) Successful in 11m6s

Mount .next/cache as a BuildKit cache volume during build to persist
the Next.js build cache across Docker rebuilds. Eliminates the
'No build cache found' warning and speeds up subsequent builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-04 14:45:55 +01:00
parent 42850ea17c
commit 74b73d1b84

View File

@@ -31,10 +31,10 @@ RUN npx prisma generate
# Copy source code (this invalidates cache when code changes) # Copy source code (this invalidates cache when code changes)
COPY . . COPY . .
# Build the application # Build the application (mount cache for faster rebuilds)
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production ENV NODE_ENV=production
RUN npm run build RUN --mount=type=cache,target=/app/.next/cache npm run build
# Verify standalone output was created and show structure for debugging # Verify standalone output was created and show structure for debugging
RUN if [ ! -d .next/standalone ]; then \ RUN if [ ! -d .next/standalone ]; then \