Files
2026-11-09 08:43:30 +03:00

26 lines
752 B
Bash
Executable File

#!/bin/sh
# Container entry point.
# serve run the API (default). With MIGRATE_ON_START=true it applies migrations first.
# migrate wait for the database, apply migrations, exit (a one-shot job)
# other passed to `python -m estimator`, e.g. `rag import /data/refs.csv`, `hash-password`
set -eu
command="${1:-serve}"
case "$command" in
serve)
if [ "${MIGRATE_ON_START:-false}" = "true" ]; then
python -m estimator wait-db --timeout "${DB_WAIT_TIMEOUT:-60}"
python -m estimator migrate
fi
exec python -m estimator serve
;;
migrate)
python -m estimator wait-db --timeout "${DB_WAIT_TIMEOUT:-60}"
exec python -m estimator migrate "${2:-head}"
;;
*)
exec python -m estimator "$@"
;;
esac