# Stage 1: Build the Vite application FROM node:20-alpine AS build WORKDIR /app # Install dependencies COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile # Copy source code and build COPY . . RUN yarn build # Stage 2: Serve with nginx FROM nginx:1.27-alpine # Copy nginx configuration tuned for a single-page application COPY nginx.conf /etc/nginx/nginx.conf # Copy built assets COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]