Aligns with the warehack-ing host convention (matches birdcage-docs):
Dockerfile — multi-stage with named targets:
base shared npm ci + COPY
dev npx astro dev --host 0.0.0.0 --port 4321 (HMR enabled)
build npx astro build (produces /app/dist)
prod caddy:2-alpine serves /srv with /health probe + HEALTHCHECK
docker-compose.yml — picks the target via APP_ENV in .env:
build.target = ${APP_ENV:-dev}
caddy.reverse_proxy upstream port = ${APP_PORT:-4321}
Adds the streaming/HMR caddy labels CLAUDE.md requires for Vite-over-
Caddy: flush_interval=-1, transport.read/write_timeout=0, keepalive,
stream_timeout=24h, stream_close_delay=5s
Volume mounts ./src, ./public, astro.config.mjs (live in dev, harmless
in prod since the prod stage doesn't reference /app)
astro.config.mjs — vite.server.hmr block now picks up VITE_HMR_HOST
env var and configures host/protocol/clientPort for wss-on-443 HMR
through Caddy. Falls back to undefined when unset so plain
'npm run dev' still works.
Caddyfile — adds /health endpoint for the Dockerfile HEALTHCHECK,
SPA-style try_files fallback chain (path -> path/index.html -> /index.html).
Makefile — adds 'make dev' / 'make prod' that rewrite APP_ENV+APP_PORT
in .env then rebuild. Tail-logs after up/restart so you see startup
diagnostics without a separate 'make logs'.
.env.example — five vars (COMPOSE_PROJECT_NAME, APP_ENV, APP_PORT,
PUBLIC_DOMAIN, VITE_HMR_HOST), defaulting to prod mode against the
public hai-omni-pro-ii.warehack.ing domain. .env stays gitignored so
each environment (local, remote) can override.
Local container rebuilt + recreated, healthy, /health returns 200,
PUBLIC_DOMAIN locally still set to .l.warehack.ing in the host .env.
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
# Astro + Starlight docs site for warehack.ing/omni-pca.
|
|
#
|
|
# Two modes via APP_ENV in .env:
|
|
# APP_ENV=dev APP_PORT=4321 astro dev with HMR (volume-mounted)
|
|
# APP_ENV=prod APP_PORT=80 caddy serving the built static dist
|
|
#
|
|
# Switch with `make dev` or `make prod` (both rebuild + restart).
|
|
|
|
services:
|
|
docs:
|
|
build:
|
|
context: .
|
|
target: ${APP_ENV:-dev}
|
|
container_name: ${COMPOSE_PROJECT_NAME:-omni-pca-docs}
|
|
restart: unless-stopped
|
|
environment:
|
|
- PUBLIC_DOMAIN=${PUBLIC_DOMAIN}
|
|
- VITE_HMR_HOST=${VITE_HMR_HOST}
|
|
networks:
|
|
- caddy
|
|
labels:
|
|
caddy: ${PUBLIC_DOMAIN}
|
|
caddy.reverse_proxy: "{{upstreams ${APP_PORT:-4321}}}"
|
|
# Streaming/HMR-friendly Caddy config (CLAUDE.md "HMR Behind Caddy"):
|
|
caddy.reverse_proxy.flush_interval: "-1"
|
|
caddy.reverse_proxy.transport: http
|
|
caddy.reverse_proxy.transport.read_timeout: "0"
|
|
caddy.reverse_proxy.transport.write_timeout: "0"
|
|
caddy.reverse_proxy.transport.keepalive: 5m
|
|
caddy.reverse_proxy.transport.keepalive_idle_conns: "10"
|
|
caddy.reverse_proxy.stream_timeout: 24h
|
|
caddy.reverse_proxy.stream_close_delay: 5s
|
|
# Volume mounts only matter in dev mode; in prod they're harmless
|
|
# (the prod stage doesn't reference /app — it serves /srv from caddy).
|
|
volumes:
|
|
- ./src:/app/src
|
|
- ./public:/app/public
|
|
- ./astro.config.mjs:/app/astro.config.mjs
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|