Multi-stage Dockerfile (node build → caddy:2-alpine production, node dev). Compose base + dev override for prod/dev switching via .env ENVIRONMENT flag. Makefile targets: build, up, down, restart, logs, dev, prod, clean, rebuild. Caddyfile serves static Astro output with caching and compression.
17 lines
421 B
Caddyfile
17 lines
421 B
Caddyfile
:80 {
|
|
root * /srv
|
|
file_server
|
|
encode gzip zstd
|
|
|
|
# SPA-style fallback for clean URLs
|
|
try_files {path} {path}/ {path}/index.html =404
|
|
|
|
# Cache static assets aggressively
|
|
@static path /_astro/* /pagefind/* /favicon.svg
|
|
header @static Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
# Short cache for HTML (allows quick content updates)
|
|
@html path *.html /
|
|
header @html Cache-Control "public, max-age=3600"
|
|
}
|