diff --git a/apps/server/Dockerfile b/apps/server/Dockerfile index 3192609..b570014 100644 --- a/apps/server/Dockerfile +++ b/apps/server/Dockerfile @@ -27,6 +27,12 @@ ENV CI=true COPY . . RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \ pnpm install --frozen-lockfile --offline +# Force the SPA to use a SAME-ORIGIN (relative) API base for THIS image. Vite auto-loads +# apps/web/.env.production, which sets VITE_API_BASE=http://127.0.0.1:3000 for the TAURI +# DESKTOP build — but here Fastify serves the SPA same-origin, so an absolute base would +# make the browser hit 127.0.0.1:3000 cross-origin and fail CORS. `.env.production.local` +# has higher precedence than `.env.production`, so this empties it for the server image only. +RUN echo 'VITE_API_BASE=' > apps/web/.env.production.local # Builds shared/db/devices, the server dist, AND the web SPA dist (apps/web/dist). RUN pnpm turbo run build --filter=@parking/server --filter=@parking/web # `pnpm deploy` produces a SELF-CONTAINED prod bundle for the server in /deploy: a hoisted