f5f7db6c2a
Add a multi-stage Dockerfile that builds the SvelteKit SPA (adapter-static, no Node runtime in the final image) and the Go server, then ships an Alpine runtime that serves both the static frontend and the API on one port. - Stage 1 (node): npm ci + build → static SPA (index.html, _app, fonts, sw) - Stage 2 (golang): CGO_ENABLED=0 static binary (image processing is pure Go) - Stage 3 (alpine): + ffmpeg for video thumbnails, non-root user, /data volume, healthcheck on /health; secrets passed at runtime, not baked in To serve the SPA on the API port, the Go server now optionally hosts static files behind a new STATIC_DIR env var: a request maps to a real file when one exists, otherwise falls back to index.html for client-side routes; unknown /api/ paths still return JSON 404. Empty STATIC_DIR (local dev) keeps the API standalone while Vite serves the UI. Cache-Control is tuned to adapter-static output (immutable hashed assets, no-cache service worker) and .webmanifest is registered so nosniff doesn't reject the PWA manifest. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
2.2 KiB
Bash
55 lines
2.2 KiB
Bash
# =============================================================================
|
|
# Tanabata File Manager — environment variables
|
|
# Copy to .env and fill in the values.
|
|
# =============================================================================
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Server
|
|
# ---------------------------------------------------------------------------
|
|
LISTEN_ADDR=:8080
|
|
JWT_SECRET=change-me-to-a-random-32-byte-secret
|
|
JWT_ACCESS_TTL=15m
|
|
JWT_REFRESH_TTL=720h
|
|
|
|
# Initial administrator, created on first startup if it does not yet exist.
|
|
# Changing the password later (via the API) is preserved across restarts.
|
|
ADMIN_USERNAME=admin
|
|
ADMIN_PASSWORD=change-me-before-first-run
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Database
|
|
# ---------------------------------------------------------------------------
|
|
DATABASE_URL=postgres://tanabata:password@localhost:5432/tanabata?sslmode=disable
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Storage
|
|
# ---------------------------------------------------------------------------
|
|
FILES_PATH=/data/files
|
|
THUMBS_CACHE_PATH=/data/thumbs
|
|
|
|
# Maximum accepted upload size in bytes (default 500 MiB).
|
|
MAX_UPLOAD_BYTES=524288000
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Thumbnails
|
|
# ---------------------------------------------------------------------------
|
|
THUMB_WIDTH=160
|
|
THUMB_HEIGHT=160
|
|
PREVIEW_WIDTH=1920
|
|
PREVIEW_HEIGHT=1080
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Import
|
|
# ---------------------------------------------------------------------------
|
|
IMPORT_PATH=/data/import
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Static SPA
|
|
# ---------------------------------------------------------------------------
|
|
# Directory of the built frontend (index.html, _app/, fonts, service worker).
|
|
# When set, the server serves the SPA and the API on the same port, with a
|
|
# fallback to index.html for client-side routes. Leave empty in local
|
|
# development — the Vite dev server serves the UI separately. The Docker image
|
|
# sets this to /app/static.
|
|
STATIC_DIR=
|