-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
53 lines (44 loc) · 1.18 KB
/
Copy pathdocker-compose.yml
File metadata and controls
53 lines (44 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
services:
app:
build: .
volumes:
- ./my-files:/app/my-files
depends_on:
ollama:
condition: service_healthy
ollama:
image: ollama/ollama
ports:
- "11434:11434"
volumes:
- ollama-data:/root/.ollama
build:
dockerfile: Dockerfile.ollama
environment:
- OLLAMA_KEEP_ALIVE=-1
healthcheck:
# CHANGE 1: Check for the marker file instead of running a command
test: ["CMD-SHELL", "[ -f /tmp/ollama_ready ] || exit 1"]
interval: 5s
timeout: 5s
retries: 20
start_period: 5s
entrypoint: ["/bin/sh", "-c"]
command:
- |
/bin/ollama serve &
pid=$$!
# Wait for Ollama to be ready
sleep 5
# Pull the model
ollama pull gemma3:1b
# Preload the model
ollama run gemma3:1b "hello" > /dev/null 2>&1 || echo "Model pre-load initiated"
echo "Ollama ready with gemma3:1b loaded"
# CHANGE 2: Create the marker file to signal the Healthcheck
touch /tmp/ollama_ready
# Wait for the background process
wait $$pid
volumes:
my-files:
ollama-data: