FROM node:22-slim AS builder WORKDIR /app ARG VITE_API_BASE_URL=http://localhost:3200 ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} COPY package.json package-lock.json* ./ RUN npm ci || npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=builder /app/dist/ /usr/share/nginx/html/ # SPA fallback: all routes to index.html RUN printf 'server {\n listen 80;\n root /usr/share/nginx/html;\n index index.html;\n location / {\n try_files $uri $uri/ /index.html;\n }\n location /api/ {\n return 404;\n }\n}\n' > /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]