# Stage 1: Build React App FROM node:18 as build # Set working directory WORKDIR /app # Copy package.json and package-lock.json COPY package*.json ./ # Install dependencies RUN npm install # Copy the rest of the source code COPY . . # Build the app RUN npm run build # Stage 2: Serve the app using Nginx FROM nginx:alpine # Copy build artifacts to Nginx's web root COPY --from=build /app/build /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Start Nginx CMD ["nginx", "-g", "daemon off;"]