| # Container entrypoint: download any missing models from models.txt, | |
| # regenerate the router preset, then start llama-server. | |
| # Everything is driven by $MODELS_TXT — there is nothing else to configure. | |
| set -euo pipefail | |
| MODELS_DIR="${MODELS_DIR:-/models}" | |
| MODELS_TXT="${MODELS_TXT:-/models.txt}" | |
| PRESET_OUTPUT="${PRESET_OUTPUT:-/models.ini}" | |
| /usr/local/bin/fetch-models.sh "$MODELS_TXT" | |
| /usr/local/bin/generate-preset.sh "$MODELS_TXT" "$PRESET_OUTPUT" | |
| echo "[entrypoint] launching: $*" | |
| if [ "$#" -eq 0 ]; then | |
| echo "[entrypoint] error: no server args provided" >&2 | |
| exit 1 | |
| fi | |
| case "${1:-}" in | |
| -*|--*) exec llama-server "$@" ;; | |
| *) exec "$@" ;; | |
| esac | |