From 28131491e2bd7e00fab4f75593498201c85fde8b Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 21 Feb 2026 22:59:47 -0800 Subject: [PATCH] fix: set API_BASE_URL at Docker build time for Next.js inlining Next.js replaces process.env.X with build-time values via DefinePlugin, even in server-side route handlers. Without the env var set during build, it always falls back to localhost:8000 which doesn't work inside Docker. Co-Authored-By: Claude Opus 4.6 --- it0-web-admin/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/it0-web-admin/Dockerfile b/it0-web-admin/Dockerfile index 4b86c70..1bd70c3 100644 --- a/it0-web-admin/Dockerfile +++ b/it0-web-admin/Dockerfile @@ -8,6 +8,11 @@ RUN npm ci COPY . . +# Set API_BASE_URL at build time so Next.js inlines the correct value +# (Next.js replaces process.env.X at build time via DefinePlugin) +ARG API_BASE_URL=http://api-gateway:8000 +ENV API_BASE_URL=${API_BASE_URL} + RUN npm run build # ===== Production =====