# Multi-stage build for optimized Astro static site FROM node:22-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy source code COPY . . # Build the Astro site RUN npm run build # Production stage - Nginx for serving static files FROM nginx:alpine # Remove default nginx static assets RUN rm -rf /usr/share/nginx/html/* # Copy built assets from builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy custom nginx config COPY docker/nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]