fix: pass Vite env vars as Docker build args

Vite reads env vars at build time, not runtime. The previous setup
only set them in docker-compose 'environment' which is only available
at container runtime. Now they are passed as build args so Vite can
embed the correct API URL during the build process.

- Add build args to web service in both compose files
- Update Dockerfile to accept ARGs and set ENV for Vite
- Fixes login redirect always going to localhost:8000
This commit is contained in:
Fusion
2026-05-18 11:09:37 +02:00
parent da0b90ce33
commit be81aa1c8b
3 changed files with 11 additions and 0 deletions
+6
View File
@@ -12,6 +12,12 @@ RUN npm install
# Copy source code
COPY . .
# Accept build arguments for API and app URLs
ARG VITE_API_BASE_URL
ARG VITE_APP_URL
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
ENV VITE_APP_URL=${VITE_APP_URL}
# Build production bundle
RUN npm run build