triflix commited on
Commit
774416f
·
verified ·
1 Parent(s): 3755265

Create entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +61 -0
entrypoint.sh ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "============================================"
5
+ echo " Starting Ollama on port 7860..."
6
+ echo "============================================"
7
+
8
+ ollama serve &
9
+ OLLAMA_PID=$!
10
+
11
+ echo "Waiting for Ollama to be ready..."
12
+ max_attempts=120
13
+ attempt=0
14
+ until curl -sf http://localhost:7860/api/tags > /dev/null 2>&1; do
15
+ sleep 1
16
+ attempt=$((attempt + 1))
17
+ if [ $attempt -ge $max_attempts ]; then
18
+ echo "ERROR: Ollama failed to start after ${max_attempts}s"
19
+ exit 1
20
+ fi
21
+ echo " attempt ${attempt}/${max_attempts}..."
22
+ done
23
+
24
+ echo "Ollama is running!"
25
+ echo ""
26
+
27
+ echo "============================================"
28
+ echo " Pulling models:"
29
+ echo " - qwen3:0.6b"
30
+ echo " - qwen3-embedding:0.6b"
31
+ echo "============================================"
32
+
33
+ ollama pull qwen3:0.6b
34
+ ollama pull qwen3-embedding:0.6b
35
+
36
+ echo ""
37
+ echo "============================================"
38
+ echo " Warming up qwen3:0.6b..."
39
+ echo "============================================"
40
+
41
+ curl -sf http://localhost:7860/api/generate \
42
+ -d '{"model":"qwen3:0.6b","prompt":"hi","stream":false}' > /dev/null 2>&1 || true
43
+
44
+ echo ""
45
+ echo "============================================"
46
+ echo " Warming up qwen3-embedding:0.6b..."
47
+ echo "============================================"
48
+
49
+ curl -sf http://localhost:7860/api/embeddings \
50
+ -d '{"model":"qwen3-embedding:0.6b","prompt":"hello"}' > /dev/null 2>&1 || true
51
+
52
+ echo ""
53
+ echo "============================================"
54
+ echo " READY!"
55
+ echo " Base URL: http://localhost:7860"
56
+ echo " Models:"
57
+ echo " - qwen3:0.6b"
58
+ echo " - qwen3-embedding:0.6b"
59
+ echo "============================================"
60
+
61
+ wait $OLLAMA_PID