diff --git a/ui/docker-entrypoint.sh b/ui/docker-entrypoint.sh index ef7cd46d..603ce30c 100644 --- a/ui/docker-entrypoint.sh +++ b/ui/docker-entrypoint.sh @@ -1,21 +1,19 @@ #!/bin/sh -# Inject tag into index.html when BASE_PATH is set. -# This allows the SPA to be served from a subpath (e.g., /server/). -# Vite builds with base: './' (relative paths), so the tag -# is sufficient — no asset path rewriting needed. -# Default: / (standalone mode, no tag needed). +# 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:-/}" -if [ "$BASE_PATH" != "/" ]; then - # Ensure BASE_PATH starts and ends with / - BASE_PATH=$(echo "$BASE_PATH" | sed 's#/*$#/#; s#^/*#/#') +# 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" +INDEX="/usr/share/nginx/html/index.html" +sed -i "s|||" "$INDEX" - echo "BASE_PATH set to ${BASE_PATH} — injected tag into index.html" -fi +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 "$@" diff --git a/ui/vite.config.ts b/ui/vite.config.ts index af041a4d..b4e74e8d 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ optimizeDeps: { include: ['swagger-ui-dist/swagger-ui-bundle'], }, - base: '/', + base: './', build: { outDir: 'dist', },