-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (117 loc) · 3.03 KB
/
Copy pathdocker-compose.yml
File metadata and controls
122 lines (117 loc) · 3.03 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
services:
db:
image: postgres:14
environment:
POSTGRES_USER: ${POSTGRES_USER:-talkai_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-talkai_password}
POSTGRES_DB: ${POSTGRES_DB:-talkai_db}
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-talkai_user} -d ${POSTGRES_DB:-talkai_db}"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
restart: unless-stopped
networks:
- talkai-network
ollama:
image: ollama/ollama
environment:
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DRIVER_CAPABILITIES: compute,utility
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "ollama list > /dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
restart: unless-stopped
networks:
- talkai-network
# Service pour installer phi3 automatiquement
ollama-init:
image: ubuntu:20.04
depends_on:
ollama:
condition: service_healthy
environment:
DEBIAN_FRONTEND: noninteractive
command: >
bash -c "
apt-get update &&
apt-get install -y curl &&
curl -fsSL https://ollama.com/install.sh | sh &&
echo 'Waiting for Ollama service to be fully ready...' &&
sleep 10 &&
OLLAMA_HOST=http://ollama:11434 ollama pull phi3 &&
echo 'Phi3 model installed successfully'
"
networks:
- talkai-network
restart: "no"
web:
build:
context: .
dockerfile: Dockerfile
command: ["/wait-and-init.sh"]
volumes:
- .:/app
- ./front/static/assets/images/avatars:/app/front/static/assets/images/avatars
- ./audio:/app/audio
- ./logs:/app/logs
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
ollama:
condition: service_healthy
ollama-init:
condition: service_completed_successfully
environment:
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DRIVER_CAPABILITIES: compute,utility
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: ${POSTGRES_USER:-talkai_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-talkai_password}
POSTGRES_DB: ${POSTGRES_DB:-talkai_db}
PYTHONPATH: /app
OLLAMA_HOST: http://ollama:11434
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
env_file:
- .env
restart: unless-stopped
networks:
- talkai-network
volumes:
postgres_data:
driver: local
ollama:
driver: local
networks:
talkai-network:
driver: bridge