Spaces:
Build error
Build error
Update entrypoint.sh
Browse files- entrypoint.sh +19 -9
entrypoint.sh
CHANGED
@@ -1,15 +1,25 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
ollama serve &
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
done
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
echo "Model pulled successfully. Keeping the server running..."
|
15 |
-
wait
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
# Function to pull and run a model
|
4 |
+
pull_and_run_model() {
|
5 |
+
local model_name=$1
|
6 |
+
echo "Pulling $model_name"
|
7 |
+
ollama pull "$model_name"
|
8 |
+
echo "Running $model_name"
|
9 |
+
ollama run "$model_name" --keepalive -1s &
|
10 |
+
}
|
11 |
+
|
12 |
+
# Starting server
|
13 |
+
echo "Starting server"
|
14 |
ollama serve &
|
15 |
+
sleep 5 # Allowing time for the server to start
|
16 |
|
17 |
+
# Splitting the models by comma and processing each
|
18 |
+
IFS=',' read -ra MODELS <<< "$model"
|
19 |
+
for m in "${MODELS[@]}"; do
|
20 |
+
pull_and_run_model "$m"
|
21 |
+
sleep 5 # Optional: Delay between starting each model
|
22 |
done
|
23 |
|
24 |
+
# Keep the script running to prevent the container from exiting
|
25 |
+
wait
|
|
|
|
|
|