Spaces:
Build error
Build error
Download docker-entrypoint.sh from anwarkxc/trackademi: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/anwarkxc/trackademi/resolve/main/docker-entrypoint.sh
- Command line
-
hf download hf://spaces/anwarkxc/trackademi/docker-entrypoint.sh
-
curl -L -o docker-entrypoint.sh https://huggingface.co/spaces/anwarkxc/trackademi/resolve/main/docker-entrypoint.sh
1.23 kB
| set -e | |
| MODEL_NAME="nomic-embed-text" | |
| echo "[Entrypoint] Starting Ollama (localhost only)..." | |
| # OLLAMA_HOST and OLLAMA_MODELS are set via Dockerfile ENV | |
| ollama serve & | |
| OLLAMA_PID=$! | |
| # Model is pre-baked — Ollama starts fast, no download needed | |
| echo "[Entrypoint] Waiting for Ollama to be ready..." | |
| for i in $(seq 1 20); do | |
| if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then | |
| echo "[Entrypoint] Ollama ready." | |
| break | |
| fi | |
| if [ "$i" -eq 20 ]; then | |
| echo "[Entrypoint] ERROR: Ollama failed to start after 20s" | |
| kill "$OLLAMA_PID" 2>/dev/null || true | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| # Verify model is present (fail fast if image was built incorrectly) | |
| if ! ollama list | grep -q "$MODEL_NAME"; then | |
| echo "[Entrypoint] ERROR: ${MODEL_NAME} not found in image — rebuild required" | |
| exit 1 | |
| fi | |
| # Warmup: load model into RAM so the first real embed request is fast | |
| echo "[Entrypoint] Warming up embedding model..." | |
| curl -s http://localhost:11434/api/embeddings \ | |
| -d "{\"model\":\"${MODEL_NAME}\",\"prompt\":\"warmup\"}" \ | |
| > /dev/null 2>&1 || true | |
| echo "[Entrypoint] Starting FastAPI..." | |
| exec uvicorn app.main:app --host 0.0.0.0 --port 8000 | |