# Use the official Node.js image. FROM node:18 AS build # Set the working directory WORKDIR /app # Copy package.json and package-lock.json (or yarn.lock) to the working directory COPY package*.json ./ # Install dependencies RUN npm install # Copy the rest of the application COPY . . # Build the application RUN npm run build # Start a new stage to serve the application FROM nginx:alpine # Copy the build output to Nginx's public folder COPY --from=build /app/dist /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Start Nginx when the container runs CMD ["nginx", "-g", "daemon off;"]