Switch static server from nginx to static-web-server

Replace nginx:alpine-slim with the scratch-based static-web-server
image, reducing the final image size ~32MB -> ~23MB (28% smaller).

- Dockerfile: serve from static-web-server:2, copy site to /public
- sws.toml: mirror previous nginx behavior (compression, cache-control,
  SPA index fallback) plus security headers and /health endpoint
- Remove now-unused nginx.conf
This commit is contained in:
2026-07-25 01:04:17 +01:00
parent 0d425c0ed1
commit 898e3003a2
3 changed files with 48 additions and 74 deletions
+43
View File
@@ -0,0 +1,43 @@
[general]
#### Server
# Listen on all interfaces, port 80 (matches previous nginx setup)
host = "0.0.0.0"
port = 80
# Root directory of the static site (Hugo `public/` output)
root = "/public"
# Number of worker threads (0 = auto-detect based on CPU cores)
threads-multiplier = 1
# Log level
log-level = "info"
#### Performance / caching
# On-the-fly gzip, brotli and zstd compression (replaces nginx `gzip on`)
compression = true
# Serve pre-compressed .gz/.br/.zst files from disk when present
compression-static = true
# Emit Cache-Control + ETag headers with sensible per-content-type defaults.
# SWS applies long-lived caching to static assets (images, css, js, fonts)
# and short/no-cache to HTML, replacing the manual nginx `expires 1y` blocks.
cache-control-headers = true
#### Routing
# SPA-style fallback: serve index.html when a path is not found on disk,
# mirroring the previous nginx `try_files $uri $uri/ /index.html`.
page-fallback = "/public/index.html"
#### Security
# Opinionated security headers (safe defaults for a static site)
security-headers = true
# Health endpoint at /health for container/K8s liveness probes
health = true