FROM node:20-alpine AS build WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html # SPA fallback: all paths → index.html RUN printf 'server {\n listen 80;\n root /usr/share/nginx/html;\n location / { try_files $uri $uri/ /index.html; }\n location /api/ { proxy_pass http://backend:8000/; }\n}\n' > /etc/nginx/conf.d/default.conf EXPOSE 80