# Stage 1: The Node Builder FROM node:20-alpine AS builder WORKDIR /app # Install dependencies COPY package*.json ./ RUN npm ci # Copy React source code and build it COPY . . RUN npm run build # Stage 2: The Nginx Server FROM nginx:alpine # Copy the compiled files from Stage 1 (Change /dist to /build if using Create-React-App instead of Vite) COPY --from=builder /app/dist /usr/share/nginx/html # Copy your custom Nginx routing file COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]