PyxiLabs commited on
Commit
16aa2f8
·
verified ·
1 Parent(s): e519b49

Update ollama.sh

Browse files
Files changed (1) hide show
  1. ollama.sh +30 -12
ollama.sh CHANGED
@@ -1,12 +1,30 @@
1
- #!/bin/sh
2
- source /app/venv/bin/activate
3
- # Start Ollama in the background
4
- # Starting server
5
- echo "Starting Ollama server"
6
- ollama serve &
7
- # Wait for the server to start
8
- sleep 5
9
- # Pull the model
10
- ollama pull all-minilm
11
-
12
- exec ollama serve
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Function to start Ollama server
4
+ start_server() {
5
+ echo "Starting Ollama server"
6
+ ollama serve &
7
+ SERVER_PID=$!
8
+ }
9
+
10
+ # Function to wait for server readiness
11
+ wait_for_server() {
12
+ echo "Waiting for server to start..."
13
+ while ! nc -z localhost 11434; do
14
+ sleep 1
15
+ done
16
+ }
17
+
18
+ # Function to pull model
19
+ pull_model() {
20
+ echo "Pulling all-minilm model"
21
+ ollama pull all-minilm
22
+ }
23
+
24
+ # Main execution
25
+ start_server
26
+ wait_for_server
27
+ pull_model
28
+
29
+ # Keep container running by waiting for server process
30
+ wait $SERVER_PID