Upload 2 files
Browse files- entrypoint.sh +19 -2
entrypoint.sh
CHANGED
|
@@ -7,6 +7,8 @@ set -euo pipefail
|
|
| 7 |
export HOME=/app
|
| 8 |
export OLLAMA_MODELS="${OLLAMA_MODELS:-/app/.ollama}"
|
| 9 |
export OLLAMA_HOST="127.0.0.1:11434"
|
|
|
|
|
|
|
| 10 |
|
| 11 |
echo "[entrypoint] starting ollama serve (models in ${OLLAMA_MODELS})..."
|
| 12 |
ollama serve &
|
|
@@ -20,8 +22,23 @@ for i in $(seq 1 60); do
|
|
| 20 |
sleep 1
|
| 21 |
done
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
echo "[entrypoint] ollama models available at runtime:"
|
| 26 |
ollama list || true
|
| 27 |
|
|
|
|
| 7 |
export HOME=/app
|
| 8 |
export OLLAMA_MODELS="${OLLAMA_MODELS:-/app/.ollama}"
|
| 9 |
export OLLAMA_HOST="127.0.0.1:11434"
|
| 10 |
+
CHAT_MODEL="${DEPTH_LLM_MODEL:-qwen2.5:3b}"
|
| 11 |
+
EMBED_MODEL="${DEPTH_EMBED_MODEL:-nomic-embed-text}"
|
| 12 |
|
| 13 |
echo "[entrypoint] starting ollama serve (models in ${OLLAMA_MODELS})..."
|
| 14 |
ollama serve &
|
|
|
|
| 22 |
sleep 1
|
| 23 |
done
|
| 24 |
|
| 25 |
+
# Self-heal: make sure the models are present. If the image bake succeeded this
|
| 26 |
+
# is instant; otherwise pull now (first cold start may take a few minutes and
|
| 27 |
+
# needs outbound network). This is why the assistant works even if the build-time
|
| 28 |
+
# model bake failed.
|
| 29 |
+
ensure_model() {
|
| 30 |
+
if ollama list 2>/dev/null | grep -qF "$1"; then
|
| 31 |
+
echo "[entrypoint] model present: $1"
|
| 32 |
+
else
|
| 33 |
+
echo "[entrypoint] model $1 missing -> pulling now (can take minutes)..."
|
| 34 |
+
ollama pull "$1" \
|
| 35 |
+
&& echo "[entrypoint] pulled: $1" \
|
| 36 |
+
|| echo "[entrypoint] WARNING: could not pull $1 -- assistant will be unavailable"
|
| 37 |
+
fi
|
| 38 |
+
}
|
| 39 |
+
ensure_model "${CHAT_MODEL}"
|
| 40 |
+
ensure_model "${EMBED_MODEL}"
|
| 41 |
+
|
| 42 |
echo "[entrypoint] ollama models available at runtime:"
|
| 43 |
ollama list || true
|
| 44 |
|