Files
cameleer-server/ui/docker-entrypoint.sh

20 lines
754 B
Bash
Raw Normal View History

#!/bin/sh
# Inject <base> tag into index.html so relative asset paths (./assets/...)
# resolve correctly regardless of the browser URL depth or subpath mount.
# Vite builds with base: './' (relative paths), so <base> is the only
# mechanism needed — no sed rewriting of asset paths required.
# Default: / (standalone mode).
BASE_PATH="${BASE_PATH:-/}"
# Ensure BASE_PATH starts and ends with /
BASE_PATH=$(echo "$BASE_PATH" | sed 's#/*$#/#; s#^/*#/#')
INDEX="/usr/share/nginx/html/index.html"
sed -i "s|<head>|<head><base href=\"${BASE_PATH}\">|" "$INDEX"
echo "BASE_PATH set to ${BASE_PATH} — injected <base> tag into index.html"
# Delegate to the default nginx entrypoint (handles envsubst for nginx templates)
exec /docker-entrypoint.sh "$@"