fix(docker): provide build-time auth/db env to next build
CI / Architecture Guardrails (push) Successful in 3m12s
CI / Assistant Split Regression (push) Successful in 4m6s
CI / Typecheck (push) Successful in 4m36s
CI / Lint (push) Successful in 4m33s
CI / Unit Tests (push) Successful in 6m40s
CI / Build (push) Successful in 6m53s
CI / Fresh-Linux Docker Deploy (push) Failing after 1m42s
CI / E2E Tests (push) Successful in 4m11s
CI / Release Images (push) Has been skipped

next build collects page data for /api/auth/[...nextauth] and aborts
when NEXTAUTH_URL/SECRET/DATABASE_URL are unset. The CI Build job
sets these as env vars; Dockerfile.prod did not, so the prod image
build failed during Release Images even though plain build worked.

Add ARG defaults that mirror the CI placeholders. Real values are
injected at container start, so build-time placeholders are inert.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 08:54:18 +02:00
parent 4cbfb2508d
commit bb117e9179
+15
View File
@@ -44,6 +44,21 @@ RUN pnpm --filter @capakraken/db db:generate
# Build the Next.js application # Build the Next.js application
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production ENV NODE_ENV=production
# next build collects page data for /api/auth/[...nextauth] which crashes
# without these envs even though they are placeholders at image-build time
# (real values are injected at container start). Mirrors the CI build job.
ARG NEXTAUTH_URL=http://localhost:3100
ARG AUTH_URL=http://localhost:3100
ARG NEXTAUTH_SECRET=ci-build-placeholder-secret-minimum-32-chars
ARG AUTH_SECRET=ci-build-placeholder-secret-minimum-32-chars
ARG DATABASE_URL=postgresql://placeholder:placeholder@localhost:5432/placeholder
ARG REDIS_URL=redis://placeholder:6379
ENV NEXTAUTH_URL=$NEXTAUTH_URL
ENV AUTH_URL=$AUTH_URL
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
ENV AUTH_SECRET=$AUTH_SECRET
ENV DATABASE_URL=$DATABASE_URL
ENV REDIS_URL=$REDIS_URL
RUN pnpm --filter @capakraken/web build RUN pnpm --filter @capakraken/web build
# ============================================================ # ============================================================