# Multi-stage Dockerfile for Astro/Starlight docs # Supports both dev (hot-reload) and prod (static) modes # ============================================================================= # Stage 1: Base with Node.js # ============================================================================= FROM node:22-slim AS base WORKDIR /app # Disable Astro telemetry ENV ASTRO_TELEMETRY_DISABLED=1 # ============================================================================= # Stage 2: Install dependencies # ============================================================================= FROM base AS deps COPY package.json package-lock.json* ./ RUN npm ci # ============================================================================= # Stage 3: Development server (hot-reload) # ============================================================================= FROM base AS dev COPY --from=deps /app/node_modules ./node_modules COPY . . # Expose Vite dev server port EXPOSE 4321 # Dev server with host binding for container access CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"] # ============================================================================= # Stage 4: Build static site # ============================================================================= FROM base AS builder COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build # ============================================================================= # Stage 5: Production with Caddy # ============================================================================= FROM caddy:2-alpine AS prod # Copy built static files COPY --from=builder /app/dist /srv # Simple Caddyfile for static file serving # (caddy-docker-proxy handles TLS and reverse proxy externally) COPY <