# Build stage FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY website/package*.json ./ # Install dependencies RUN npm ci # Copy source code COPY website/ ./ # Build the application RUN npm run build # Production stage FROM nginx:alpine # Copy built files from builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx configuration for SPA routing RUN echo 'server { \ listen 80; \ server_name _; \ root /usr/share/nginx/html; \ index index.html; \ location / { \ try_files $uri $uri/ /index.html; \ } \ }' > /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]