# Stage 1: Build the Vite application FROM node:20-alpine AS builder # Set working directory WORKDIR /app # Copy package.json and package-lock.json (if available) COPY package*.json ./ # Install dependencies RUN npm install # Copy the rest of the application code COPY . . # Build the application for production RUN npm run build # Stage 2: Serve the application with Nginx FROM nginx:alpine # Copy the built assets from the builder stage to Nginx's default public directory COPY --from=builder /app/dist /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Start Nginx CMD ["nginx", "-g", "daemon off;"]