ollama / entrypoint.sh
we2app's picture
Update entrypoint.sh
d3bc0d9 verified
Raw
History Blame Contribute Delete
932 Bytes
#!/bin/sh
set -eu
echo "[ollamaServer] Starting Ollama on ${OLLAMA_HOST}"
ollama serve &
OLLAMA_PID=$!
# Wait until Ollama responds.
TRIES=0
until ollama list >/dev/null 2>&1; do
TRIES=$((TRIES + 1))
if [ "$TRIES" -gt 180 ]; then
echo "[ollamaServer] Ollama did not become ready in time"
kill "$OLLAMA_PID" || true
exit 1
fi
sleep 1
done
echo "[ollamaServer] Ollama is ready"
pull_if_missing() {
MODEL="$1"
if ollama list | awk 'NR>1 {print $1}' | grep -Fxq "$MODEL"; then
echo "[ollamaServer] Model already present: $MODEL"
else
echo "[ollamaServer] Pulling model: $MODEL"
ollama pull "$MODEL"
fi
}
pull_if_missing "embeddinggemma:latest"
pull_if_missing "hf.co/LiquidAI/LFM2-1.2B-RAG-GGUF:Q5_K_M"
pull_if_missing "hf.co/MaziyarPanahi/gemma-3-1b-it-GGUF:Q3_K_M"
pull_if_missing "ornith:9b"
pull_if_missing "nemotron-3-nano:4b"
echo "[ollamaServer] Startup complete"
wait "$OLLAMA_PID"