-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
81 lines (76 loc) · 1.96 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
81 lines (76 loc) · 1.96 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- 11434:11434
volumes:
- ollama_data:/root/.ollama
- ./scripts/start_ollama.sh:/start_ollama.sh:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
env_file:
- .env
environment:
# - CUDA_VISIBLE_DEVICES=0 # Prioritizes GPU 0 exclusively for container
- OLLAMA_CONTEXT_LENGTH=2048 # Safe for 4GB
# - OLLAMA_FLASH_ATTENTION=false # Avoids allocation crashes
- OLLAMA_NUM_PARALLEL=1 # Single model load
- OLLAMA_MAX_LOADED_MODELS=1
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ["0"] # Lock to GPU 0
capabilities: [gpu]
networks:
- local_code_network
entrypoint: ["/start_ollama.sh"]
agent:
build:
context: ./agent
dockerfile: Dockerfile
container_name: agent
depends_on:
ollama:
condition: service_healthy
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
volumes:
- ./workspace:/workspace:rw
working_dir: /app
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
- /run:size=16m,mode=1777
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
restart: unless-stopped
stdin_open: true
tty: true
networks:
- local_code_network
labels:
- com.centurylinklabs.watchtower.enable=true
watchtower:
image: containrrr/watchtower:latest
container_name: watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --label-enable --cleanup --interval 300
volumes:
ollama_data:
networks:
local_code_network:
driver: bridge