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
This commit is contained in:
Claude
2026-04-02 18:21:28 +00:00
parent 611414ff17
commit 53a05feae5
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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