-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (85 loc) · 2.28 KB
/
docker-compose.yml
File metadata and controls
90 lines (85 loc) · 2.28 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
services:
db:
image: postgres:13
restart: always
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
# Backend service without GPU support (for OpenAI)
backend:
profiles: ["openai"]
build:
context: .
dockerfile: backend/Dockerfile
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
env_file: .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?sslmode=disable
command: bash -c "./download_model.sh && ./entrypoint.sh uvicorn backend.main:app --host 0.0.0.0 --port 8000"
# Backend service with GPU support (for local LLama)
backend-gpu:
profiles: ["local"]
build:
context: .
dockerfile: backend/Dockerfile
ports:
- "8000:8000"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
depends_on:
db:
condition: service_healthy
env_file: .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?sslmode=disable
volumes:
- ./models:/app/models
command: bash -c "./download_model.sh && ./entrypoint.sh uvicorn backend.main:app --host 0.0.0.0 --port 8000"
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
ports:
- "8501:8501"
depends_on:
- ${BACKEND_SERVICE:-backend}
environment:
- BACKEND_URL=http://${BACKEND_SERVICE:-backend}:8000
mongodb:
image: mongo:latest
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 3
volumes:
postgres_data:
mongo_data: