# Build stage FROM node:22-alpine AS build WORKDIR /app RUN corepack enable COPY frontend/package.json frontend/pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile COPY frontend/ . RUN pnpm build # Production stage FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html # SPA fallback + API proxy config RUN echo 'server { \ listen 80; \ root /usr/share/nginx/html; \ index index.html; \ location / { \ try_files $uri $uri/ /index.html; \ } \ location /api/ { \ proxy_pass http://backend:8000; \ } \ location /ws/ { \ proxy_pass http://backend:8000; \ proxy_http_version 1.1; \ proxy_set_header Upgrade $http_upgrade; \ proxy_set_header Connection "upgrade"; \ } \ }' > /etc/nginx/conf.d/default.conf EXPOSE 80