# Use an official Node.js runtime as the base image FROM node:18-alpine as builder # Set the working directory in the container WORKDIR /app # Copy package.json and package-lock.json to the working directory COPY package*.json ./ # Install any needed dependencies RUN npm install # Copy the rest of the application code COPY . . # Build the application RUN npm run build # Use an official Nginx runtime as the base image FROM nginx:stable-alpine # Set the working directory in the container WORKDIR /usr/share/nginx/html # Remove default nginx static files RUN rm -rf ./* # Copy static files from the builder stage COPY --from=builder /app/dist . # Expose port 80 EXPOSE 80 # Command to run when starting the container CMD ["nginx", "-g", "daemon off;"]