# Use the official Node.js image as the base FROM node:18 # Set the working directory inside the container WORKDIR /app # Copy package.json and package-lock.json to the working directory COPY package*.json ./ # Install the dependencies RUN npm ci # Copy the entire project to the working directory COPY . . # Build the React application RUN npm run build # Use the official Nginx image as the base for serving the built files FROM nginx:stable-alpine # Copy the built files from the previous stage to the Nginx HTML directory COPY --from=0 /app/dist /usr/share/nginx/html # Expose the default Nginx port EXPOSE 7860 # Start Nginx when the container launches CMD ["nginx", "-g", "daemon off;"]