# Multi-stage Dockerfile for How to Talk to Claude with Caddy # Stage 1: Build the Astro site FROM node:18-alpine AS builder # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production --silent # Copy source code COPY . . # Build the static site using production config (avoids plugin conflicts) RUN npx astro build --config ./astro.config.prod.mjs # Stage 2: Serve the built site with Caddy FROM caddy:2-alpine AS production # Copy built site from builder stage COPY --from=builder /app/dist /usr/share/caddy # Copy Caddyfile COPY Caddyfile /etc/caddy/Caddyfile # Expose port 80 EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1 # Caddy runs as non-root by default, starts automatically