-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
146 lines (139 loc) · 3.33 KB
/
docker-compose.yml
File metadata and controls
146 lines (139 loc) · 3.33 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
services:
# PostgreSQL
postgres-db:
image: postgres:17
container_name: postgres-db
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- backend
ports:
- "5432:5432"
# Redis
redis:
image: redis:latest
container_name: redis
networks:
- backend
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# FastAPI App (only this builds)
app:
build:
context: .
dockerfile: Dockerfile
image: my-fastapi-app:latest
container_name: fastapi_app
environment:
REDIS_URL: ${REDIS_URL}
WATCHFILES_FORCE_POLLING: "true"
ports:
- "8000:8000"
volumes:
- ./backend:/app/backend
- ./uploads:/app/uploads
- ./pip_cache:/root/.cache/pip
depends_on:
- postgres-db
- redis
networks:
- backend
# Celery Frame Worker (reuses image)
celery-frame-worker:
image: my-fastapi-app:latest
hostname: frame_worker
container_name: celery-frame-worker
working_dir: /app/backend
environment:
- CELERY_MODULE=${CELERY_MODULE}
- REDIS_URL=${REDIS_URL}
- PYTHONPATH=/app/backend
volumes:
- ./backend:/app/backend
- ./pip_cache:/root/.cache/pip
- ./uploads:/app/uploads
depends_on:
- redis
- postgres-db
networks:
- backend
command: >
celery -A ${CELERY_MODULE}.celery_app worker
-Q frame_selection_queue
--loglevel=info
--concurrency=2
healthcheck:
test:
[
"CMD-SHELL",
"celery -A ${CELERY_MODULE}.celery_app inspect ping -t 1 | grep -q 'ok'",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
celery-detection-worker:
image: my-fastapi-app:latest
hostname: detection_worker
working_dir: /app/backend
environment:
- CELERY_MODULE=${CELERY_MODULE}
- REDIS_URL=${REDIS_URL}
- PYTHONPATH=/app/backend
volumes:
- ./backend:/app/backend
- ./pip_cache:/root/.cache/pip
- ./uploads:/app/uploads
depends_on:
- redis
- postgres-db
networks:
- backend
command: celery -A ${CELERY_MODULE}.celery_app worker -Q deepfake_detection_queue --loglevel=info --concurrency=1
healthcheck:
test:
[
"CMD-SHELL",
"celery -A ${CELERY_MODULE}.celery_app inspect ping -t 1 | grep -q 'ok'",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
flower:
image: my-fastapi-app:latest
container_name: flower
working_dir: /app/backend
command: >
sh -c "sleep 10 && celery -A ${CELERY_MODULE}.celery_app flower --port=5555"
environment:
- CELERY_MODULE=${CELERY_MODULE}
- REDIS_URL=${REDIS_URL}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- PYTHONPATH=/app/backend
volumes:
- ./backend:/app/backend
- ./pip_cache:/root/.cache/pip
- ./uploads:/app/uploads
ports:
- "5555:5555"
depends_on:
- celery-frame-worker
- redis
networks:
- backend
networks:
backend:
driver: bridge
volumes:
postgres_data:
pip-cache: