#!/bin/sh # Inject 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 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|||" "$INDEX" echo "BASE_PATH set to ${BASE_PATH} — injected tag into index.html" # Delegate to the default nginx entrypoint (handles envsubst for nginx templates) exec /docker-entrypoint.sh "$@"