# --- Step 1: Build the React Application --- FROM node:20-alpine AS build-stage WORKDIR /app # Install dependencies COPY package.json package-lock.json ./ RUN npm ci # Copy source files and build COPY . . RUN npm run build # --- Step 2: Serve the Built Assets via Nginx --- FROM nginx:alpine WORKDIR /usr/share/nginx/html # Clean default Nginx files RUN rm -rf ./* # Copy built assets from Stage 1 (Vite default output is "dist") COPY --from=build-stage /app/dist . # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 3000 CMD ["nginx", "-g", "daemon off;"]