forked from Abhash-Chakraborty/Find
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
168 lines (162 loc) · 4.87 KB
/
Copy pathdocker-compose.yml
File metadata and controls
168 lines (162 loc) · 4.87 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
services:
# PostgreSQL Database with pgvector
db:
image: ankane/pgvector:latest
container_name: find-db
environment:
POSTGRES_DB: find
POSTGRES_USER: find
POSTGRES_PASSWORD: find123
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U find"]
interval: 10s
timeout: 5s
retries: 5
# Redis for job queue
redis:
image: redis:7-alpine
command: redis-server --loglevel warning
container_name: find-redis
hostname: redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# MinIO for object storage
minio:
image: minio/minio:latest
container_name: find-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
ports:
- "${MINIO_HOST_PORT:-9200}:9000"
- "${MINIO_CONSOLE_HOST_PORT:-9201}:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
# FastAPI Backend
api:
image: find-backend
build:
context: ./backend
dockerfile: Dockerfile
args:
BASE_IMAGE: ${BACKEND_BASE_IMAGE:-nvidia/cuda:12.1.1-runtime-ubuntu22.04}
PYTHON_VERSION: ${BACKEND_PYTHON_VERSION:-3.12}
container_name: find-api
command: uvicorn find_api.main:app --host 0.0.0.0 --port 8000 --log-level warning
ports:
- "8000:8000"
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://find:find123@db:5432/find}
- MINIO_ENDPOINT=${MINIO_ENDPOINT:-minio:9000}
- MINIO_PUBLIC_ENDPOINT=${MINIO_PUBLIC_ENDPOINT:-http://localhost:9200/images}
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY:-minioadmin}
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-minioadmin}
- MINIO_BUCKET=${MINIO_BUCKET:-images}
- MINIO_PUBLIC_READ=${MINIO_PUBLIC_READ:-false}
- MINIO_SECURE=${MINIO_SECURE:-false}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- USE_GPU=${USE_GPU:-true}
- API_HOST=0.0.0.0
- API_PORT=8000
- MODEL_MANAGER_PROCESS_NAME=api
- PYTHONUNBUFFERED=1
volumes:
- ./backend:/app
- model_cache:/root/.cache
gpus: all
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
restart: unless-stopped
# RQ Worker for background ML processing
worker:
image: find-backend
container_name: find-worker
command: rq worker --worker-class ${RQ_WORKER_CLASS:-rq.worker.worker_classes.SimpleWorker} --url ${REDIS_URL:-redis://redis:6379} high default low
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://find:find123@db:5432/find}
- MINIO_ENDPOINT=${MINIO_ENDPOINT:-minio:9000}
- MINIO_PUBLIC_ENDPOINT=${MINIO_PUBLIC_ENDPOINT:-http://localhost:9200/images}
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY:-minioadmin}
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-minioadmin}
- MINIO_BUCKET=${MINIO_BUCKET:-images}
- MINIO_PUBLIC_READ=${MINIO_PUBLIC_READ:-false}
- MINIO_SECURE=${MINIO_SECURE:-false}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- USE_GPU=${USE_GPU:-true}
- MODEL_MANAGER_PROCESS_NAME=worker
- PYTHONUNBUFFERED=1
volumes:
- ./backend:/app
- model_cache:/root/.cache
depends_on:
- api
- redis
- db
restart: unless-stopped
gpus: all
deploy:
resources:
limits:
memory: 8G
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# Next.js Frontend
web:
build:
context: ./frontend
dockerfile: Dockerfile
target: production
container_name: find-web
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_URL=http://localhost:8000
- NEXT_PUBLIC_MINIO_BUCKET=${NEXT_PUBLIC_MINIO_BUCKET:-images}
- NEXT_PUBLIC_MINIO_URL=${NEXT_PUBLIC_MINIO_URL:-http://localhost:9200}
- NEXT_PUBLIC_MAX_BULK_FILES=${NEXT_PUBLIC_MAX_BULK_FILES:-200}
- NEXT_PUBLIC_MAX_UPLOAD_SIZE_MB=${NEXT_PUBLIC_MAX_UPLOAD_SIZE_MB:-50}
- NODE_ENV=production
depends_on:
- api
restart: unless-stopped
volumes:
db_data:
driver: local
redis_data:
driver: local
minio_data:
driver: local
model_cache:
driver: local