2026-04-05 21:04:28 +02:00
|
|
|
#!/bin/sh
|
2026-04-13 21:30:00 +02:00
|
|
|
# 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).
|
2026-04-05 21:04:28 +02:00
|
|
|
|
|
|
|
|
BASE_PATH="${BASE_PATH:-/}"
|
|
|
|
|
|
2026-04-13 21:30:00 +02:00
|
|
|
# Ensure BASE_PATH starts and ends with /
|
|
|
|
|
BASE_PATH=$(echo "$BASE_PATH" | sed 's#/*$#/#; s#^/*#/#')
|
2026-04-05 21:04:28 +02:00
|
|
|
|
2026-04-13 21:30:00 +02:00
|
|
|
INDEX="/usr/share/nginx/html/index.html"
|
|
|
|
|
sed -i "s|<head>|<head><base href=\"${BASE_PATH}\">|" "$INDEX"
|
2026-04-05 21:04:28 +02:00
|
|
|
|
2026-04-13 21:30:00 +02:00
|
|
|
echo "BASE_PATH set to ${BASE_PATH} — injected <base> tag into index.html"
|
2026-04-05 21:04:28 +02:00
|
|
|
|
|
|
|
|
# Delegate to the default nginx entrypoint (handles envsubst for nginx templates)
|
|
|
|
|
exec /docker-entrypoint.sh "$@"
|