mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-04 12:13:05 +00:00
- The frontend image ran the Vite dev server in development mode, so .env.development supplied its defaults (notification banner, Google client id, local API host). The static build only loads .env.production, so the build stage now copies .env.development in as the baseline and the compose files pass every VITE_* the app reads through from .env; the runtime script skips empty values so a blank passthrough keeps the build-time default. .dockerignore kept only the .local variants out. - VITE_DISABLE_SOURCE_FE disables sources only when it is the string true. - DoclingParser: find_spec raises when docling itself is absent; the install hint now covers that path, with a regression test. - verify_offline: direct tests for verify(); the PR image check builds and verifies the -docling variant as well as slim. - Workflows this branch adds or rewrites pin actions by commit, pass the release tag through env instead of template expansion, and do not persist checkout credentials. - OCR guide no longer claims pre-built images never include docling.
26 lines
1.0 KiB
Bash
26 lines
1.0 KiB
Bash
#!/bin/sh
|
|
# Expose the container's VITE_* environment to the static bundle.
|
|
#
|
|
# nginx's entrypoint runs everything in /docker-entrypoint.d before serving.
|
|
# The generated /config.js is loaded by index.html ahead of the app bundle and
|
|
# read by src/env.ts, so VITE_API_HOST and friends can differ per deployment
|
|
# without rebuilding the image.
|
|
set -eu
|
|
|
|
out=/usr/share/nginx/html/config.js
|
|
{
|
|
printf 'window.__DOCSGPT_ENV__ = {'
|
|
first=1
|
|
env | grep -E '^VITE_[A-Za-z0-9_]+=.' | while IFS='=' read -r key value; do
|
|
# Empty values are skipped above (=.) so a compose passthrough like
|
|
# ${VITE_X:-} leaves the build-time default in place.
|
|
# JSON-escape backslashes and double quotes; values are plain URLs/ids.
|
|
escaped=$(printf '%s' "$value" | sed 's/\\/\\\\/g; s/"/\\"/g')
|
|
if [ "$first" -eq 1 ]; then first=0; else printf ','; fi
|
|
printf '"%s":"%s"' "$key" "$escaped"
|
|
done
|
|
printf '};\n'
|
|
} > "$out"
|
|
|
|
echo "runtime-env: wrote $(grep -o 'VITE_[A-Za-z0-9_]*' "$out" | wc -l | tr -d ' ') VITE_* values to /config.js"
|