Fix API URL config: use Next.js rewrite proxy instead of NEXT_PUBLIC_*

NEXT_PUBLIC_* is baked at build time so runtime docker-compose environment
vars have no effect. Instead:
- next.config.ts rewrites /api/* -> API_BASE_URL/api/* at the server level
- api.ts uses relative paths (no env var in client bundle at all)
- docker-compose passes API_BASE_URL=http://cvfs-backend:8080 at runtime
- Dockerfile no longer needs any build args

Requests: browser -> Next.js server (/api/*) -> cvfs-backend:8080 (/api/*)

https://claude.ai/code/session_01Xmxm2QLgFBgRJyYD6VukR6
This commit is contained in:
Claude
2026-04-02 18:23:58 +00:00
parent 53a05feae5
commit f3d1ddad5d
4 changed files with 9 additions and 6 deletions

View File

@@ -8,8 +8,6 @@ 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