Add Dockerfile and compose setup for self-hosting

Multi-stage build: Node builds the static PWA, nginx serves it with an SPA
fallback, long-lived caching for hashed assets, no-cache for the app shell
and service worker, and the correct type for the web manifest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
This commit is contained in:
agent 2026-09-26 22:33:08 +00:00
parent 08a530c78f
commit 23d0c29e0b
5 changed files with 72 additions and 0 deletions

33
docker/nginx.conf Normal file
View file

@ -0,0 +1,33 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json application/manifest+json image/svg+xml;
# Hashed build output never changes.
location /_app/immutable/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# The service worker and app shell must be re-checked so updates reach clients.
location = /service-worker.js {
add_header Cache-Control "no-cache";
try_files $uri =404;
}
# nginx's default MIME table has no entry for the PWA manifest.
location ~ \.webmanifest$ {
types { }
default_type application/manifest+json;
add_header Cache-Control "no-cache";
}
# Client-side app: unknown paths fall back to the SPA shell.
location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/ /index.html;
}
}