Multi-stage Dockerfile: node:22-slim build → caddy:2-alpine serve. caddy-docker-proxy labels for automatic TLS + reverse proxy. Profiles: prod (Caddy static) and dev (Astro HMR with volume mounts).
39 lines
787 B
YAML
39 lines
787 B
YAML
services:
|
|
docs:
|
|
build: .
|
|
restart: unless-stopped
|
|
networks:
|
|
- caddy
|
|
labels:
|
|
caddy: ${DOMAIN}
|
|
caddy.reverse_proxy: "{{upstreams 80}}"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:80/"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
profiles:
|
|
- prod
|
|
|
|
docs-dev:
|
|
build:
|
|
context: .
|
|
target: deps
|
|
command: npx astro dev --host 0.0.0.0 --port 4321
|
|
ports:
|
|
- "4321:4321"
|
|
volumes:
|
|
- ./src:/app/src
|
|
- ./public:/app/public
|
|
- ./astro.config.mjs:/app/astro.config.mjs
|
|
- ./tsconfig.json:/app/tsconfig.json
|
|
environment:
|
|
- ASTRO_TELEMETRY_DISABLED=1
|
|
- VITE_HMR_HOST=${VITE_HMR_HOST:-}
|
|
profiles:
|
|
- dev
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|