Bake PUBLIC_URL into the frontend bundle at build time

↗ view on GitHub · Claude · 2026-05-16 · 0f2b965c

Next.js inlines NEXT_PUBLIC_* env vars into the client JS bundle at
`npm run build` time; they're not read at runtime. The frontend
Dockerfile wasn't accepting that value as a build arg, so the
client bundle was always built with the source-default fallback of
http://localhost:3001 and the browser tried to hit localhost for
every API call (visible in DevTools as ERR_CONNECTION_REFUSED on
/me, /me/onboarding-options, /user/profile, etc.).

Add an ARG NEXT_PUBLIC_API_BASE_URL to the frontend build stage and
wire docker-compose.yml to pass ${PUBLIC_URL} into it. The runtime
env block already mirrors the same value for server-side fetches.

After this lands, `update.sh` rebuilds the frontend image with the
right URL baked in.
Repository cpatpa/PIP
Author Claude <noreply@anthropic.com>
Authored
Parents 35e409f6
Stats 2 files changed , +16
Part of Bare-metal installer + operator tooling

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-0f2b965c.md from inside the repo you want the change in.

⬇ Download capture-commit-0f2b965c.md