mirror of
https://github.com/vegu-ai/talemate.git
synced 2026-02-24 20:49:44 +01:00
* fix(docker): use explicit directory paths in COPY commands The previous COPY command copied the contents of scenes and templates directly into /app/ instead of preserving the directory structure. This change ensures each directory is copied as a subdirectory: - scenes/ -> /app/scenes/ - templates/ -> /app/templates/ - chroma* -> /app/ (glob pattern, unchanged) * feat(frontend): add vite-plugin-runtime-env for runtime configuration feat(docker): add entrypoint for runtime environment substitution chore(docker): add WebSocket URL env var to compose files docs: add runtime WebSocket configuration documentation Add vite-plugin-runtime-env to enable runtime environment variable configuration. This plugin rewrites import.meta.env.VITE_* references to window.env.VITE_* at build time and injects placeholders into index.html that can be substituted at container startup using envsubst. This enables configuring VITE_TALEMATE_BACKEND_WEBSOCKET_URL at container runtime without rebuilding the Docker image. Add docker-entrypoint.sh that uses envsubst to replace environment variable placeholders in index.html at container startup. Update troubleshoot.md: - Add section on configuring WebSocket URL at runtime - Replace placeholder reverse proxy section with actual working instructions - Add nginx WebSocket proxy configuration example Update change-host-and-port.md: - Add Docker runtime configuration section - Document configuration priority (runtime env var vs auto-detection) * chore(Dockerfile): add copy command for tts directory to include text-to-speech functionality
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
#
|
|
# Talemate Docker Entrypoint
|
|
#
|
|
# Replaces environment variable placeholders in the frontend bundle
|
|
# at container startup, enabling runtime configuration.
|
|
#
|
|
# Environment Variables:
|
|
# VITE_TALEMATE_BACKEND_WEBSOCKET_URL - WebSocket URL for backend connection
|
|
# Leave empty/unset for auto-detection
|
|
#
|
|
|
|
TEMPLATE_FILE="/app/talemate_frontend/dist/index.template.html"
|
|
OUTPUT_FILE="/app/talemate_frontend/dist/index.html"
|
|
|
|
echo "============================================"
|
|
echo "Talemate Docker Entrypoint"
|
|
echo "============================================"
|
|
|
|
if [ -f "$TEMPLATE_FILE" ]; then
|
|
echo "Substituting environment variables..."
|
|
echo " VITE_TALEMATE_BACKEND_WEBSOCKET_URL: ${VITE_TALEMATE_BACKEND_WEBSOCKET_URL:-<not set, will auto-detect>}"
|
|
|
|
# Use envsubst to replace ${VAR} placeholders with actual values
|
|
envsubst < "$TEMPLATE_FILE" > "$OUTPUT_FILE"
|
|
|
|
echo "Runtime config applied to index.html"
|
|
else
|
|
echo "Warning: Template file not found, skipping envsubst"
|
|
fi
|
|
|
|
echo "Starting Talemate..."
|
|
echo "============================================"
|
|
|
|
# Execute the main command
|
|
exec "$@"
|