mcnanovna-docs/Dockerfile
Ryan Malloy e21219be8d Initial docs site: Astro/Starlight with caddy-docker-proxy
- Starlight documentation for mcnanovna and mcpositioner
- 19 pages covering tools, prompts, hardware, and tutorials
- Docker deployment with dev/prod modes
- Makefile for docker compose management
- Custom SVG logos and hero illustration
2026-02-04 13:53:21 -07:00

69 lines
2.1 KiB
Docker

# 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 <<EOF /etc/caddy/Caddyfile
:80 {
root * /srv
file_server
try_files {path} {path}/ /index.html
encode gzip
# Cache static assets
@static path *.js *.css *.woff2 *.png *.svg *.jpg *.ico
header @static Cache-Control "public, max-age=31536000, immutable"
# Don't cache HTML
@html path *.html /
header @html Cache-Control "no-cache, no-store, must-revalidate"
}
EOF
EXPOSE 80