fix: Web Dockerfile — set NEXT_PUBLIC_API_URL at build time
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 11s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 16s
Deploy / Build Web Image (push) Failing after 7s
Deploy / Build AI Services Image (push) Failing after 8s
E2E Tests / Playwright E2E (push) Failing after 10s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped

NEXT_PUBLIC_* env vars are inlined into the JS bundle during next build.
Without setting them as build ARGs, the client-side apiClient falls back
to localhost:3001 which doesn't work in production.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-14 19:54:56 +07:00
parent 50ba043f35
commit b9ad280192

View File

@@ -14,6 +14,11 @@ RUN pnpm install --frozen-lockfile --filter @goodgo/web...
# ---- Build ----
FROM base AS build
# NEXT_PUBLIC_* vars are baked into JS bundle at build time
ARG NEXT_PUBLIC_API_URL=https://api.goodgo.vn
ARG NEXT_PUBLIC_WEB_URL=https://platform.goodgo.vn
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_WEB_URL=$NEXT_PUBLIC_WEB_URL
COPY --from=deps /app/.npmrc ./
COPY --from=deps /app/node_modules ./node_modules
COPY tsconfig.base.json ./