From 53a05feae5ce1a3d4626eca5b764f39f14a2890d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 18:21:28 +0000 Subject: [PATCH] Fix NEXT_PUBLIC_API_BASE_URL not applying in production build NEXT_PUBLIC_* vars are inlined at build time, not runtime. Pass as Docker build arg so Next.js picks it up during bun run build. https://claude.ai/code/session_01Xmxm2QLgFBgRJyYD6VukR6 --- docker-compose.yml | 4 ++-- docker/webapp.Dockerfile | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5ee20e9..4b1b219 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,8 @@ services: build: context: ./ dockerfile: ./docker/webapp.Dockerfile - environment: - - NEXT_PUBLIC_API_BASE_URL=https://api.cv.alves.world + args: + - NEXT_PUBLIC_API_BASE_URL=https://api.cv.alves.world networks: - dokploy-network - cvfs-network diff --git a/docker/webapp.Dockerfile b/docker/webapp.Dockerfile index cfddcce..ff14edb 100644 --- a/docker/webapp.Dockerfile +++ b/docker/webapp.Dockerfile @@ -8,6 +8,8 @@ COPY apps/webapp/package.json apps/webapp/bun.lock ./ RUN bun install --frozen-lockfile FROM deps AS builder +ARG NEXT_PUBLIC_API_BASE_URL=http://localhost:9812 +ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL COPY apps/webapp ./ RUN bun run build