Set PUBLIC_API_URL at build time for production

Vite inlines import.meta.env.PUBLIC_* at build time, not runtime.
Without this, the frontend falls back to localhost:8099 which doesn't
exist from the browser. Empty string means same-origin requests,
letting Caddy route /api/* to the backend.
This commit is contained in:
Ryan Malloy 2026-02-13 03:45:23 -07:00
parent fb5b911ea1
commit 9b2737ef77

View File

@ -24,6 +24,12 @@ RUN npm ci
COPY . . COPY . .
ENV ASTRO_TELEMETRY_DISABLED=1 ENV ASTRO_TELEMETRY_DISABLED=1
# PUBLIC_API_URL must be set at build time for Vite to inline it.
# Empty string = same-origin (Caddy routes /api/* to backend).
ARG PUBLIC_API_URL=""
ENV PUBLIC_API_URL=${PUBLIC_API_URL}
RUN npm run build RUN npm run build