From bb117e917996bfa65177a639e319b980db4007be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hartmut=20N=C3=B6renberg?= Date: Mon, 13 Apr 2026 08:54:18 +0200 Subject: [PATCH] fix(docker): provide build-time auth/db env to next build 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 --- Dockerfile.prod | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Dockerfile.prod b/Dockerfile.prod index 17f0f19..e0d112b 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -44,6 +44,21 @@ RUN pnpm --filter @capakraken/db db:generate # Build the Next.js application ENV NEXT_TELEMETRY_DISABLED=1 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 # ============================================================