# Stage 1: Build React App with Node FROM node:20-alpine AS build WORKDIR /app # Install dependencies COPY package.json package-lock.json* ./ RUN npm install # Copy source code and build COPY . . RUN npm run build # Stage 2: Serve with Nginx FROM nginx:alpine # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy build artifacts to Nginx html directory COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]