rmm2/frontend/docker-entrypoint.sh
cynfo3000 582eb5c8c1 Docker: Runtime-Config via window.__RMM_CONFIG__ (kein Rebuild bei Backend-Wechsel)
- Dockerfile: multistage build (node -> nginx)
- docker-entrypoint.sh: injiziert BACKEND_HOST/PORT zur Laufzeit
- nginx.conf: SPA-Routing, config.js no-cache
- index.html: laedt /config.js vor dem React-Bundle

Usage: docker run -e BACKEND_HOST=rmm.example.com -e BACKEND_PORT=8443 -p 80:80 rmm-frontend
2026-03-10 17:43:53 +01:00

17 lines
448 B
Bash

#!/bin/sh
# Injiziert BACKEND_HOST/PORT zur Laufzeit in window.__RMM_CONFIG__
# So muss das Image nicht neu gebaut werden wenn sich der Backend-Host ändert
CONFIG_JS="/usr/share/nginx/html/config.js"
cat > "$CONFIG_JS" << EOF
// Injiziert durch Docker-Entrypoint
window.__RMM_CONFIG__ = {
backendHost: "${BACKEND_HOST}",
backendPort: "${BACKEND_PORT}"
};
EOF
echo "RMM Frontend: Backend = https://${BACKEND_HOST}:${BACKEND_PORT}"
exec "$@"