feat: add runtime configuration for Caddy-based SPA containerization

Introduced `config.json` runtime configuration fetch mechanism to support the "Build Once, Deploy Everywhere" pattern. Replaced NGINX with Caddy for SPA deployment, enabling SPA routing, security headers, and static asset management. Updated Gradle and Kotlin/JS build configurations to align with the new runtime environment. Enhanced Dockerfile and health checks for optimized CI/CD workflows and improved SPA delivery.
This commit is contained in:
2026-02-02 16:19:20 +01:00
parent 86d8d780f5
commit 11c597f147
17 changed files with 327 additions and 193 deletions
+41
View File
@@ -0,0 +1,41 @@
:4000 {
# Root directory for static files
root * /usr/share/caddy
# Enable Gzip/Zstd compression
encode gzip zstd
# Serve static files
file_server
# Templates for runtime configuration (config.json)
templates {
mime application/json
}
# SPA Routing: Fallback to index.html for non-existent files
try_files {path} /index.html
# Cache Control for static assets (immutable)
@static {
file
path *.js *.css *.png *.jpg *.svg *.wasm
}
header @static Cache-Control "public, max-age=31536000, immutable"
# Security Headers (Future Proofing for Wasm)
header {
# Cross-Origin Isolation for SharedArrayBuffer (required for some Wasm features)
Cross-Origin-Opener-Policy "same-origin"
Cross-Origin-Embedder-Policy "require-corp"
# Standard Security Headers
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
}
# Health Check
handle /health {
respond "healthy" 200
}
}