-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
66 lines (59 loc) · 1.26 KB
/
docker-compose.yml
File metadata and controls
66 lines (59 loc) · 1.26 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
version: '3.8'
services:
# 1. Database (Postgres)
db:
image: postgres:15-alpine
container_name: star_db
env_file: .env
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: always
# 2. Broker (Redis)
redis:
image: redis:7-alpine
container_name: star_redis
ports:
- "6379:6379"
restart: always
# 3. FastAPI App
app:
build: .
container_name: star_app
user: root # Required for Docker socket access
ports:
- "8000:8000"
volumes:
- .:/app
- /var/run/docker.sock:/var/run/docker.sock # Docker-in-Docker socket
env_file:
- .env
depends_on:
- db
- redis
restart: always
# 4. Celery Worker (no container_name to allow scaling)
worker:
build: .
command: sh -c "celery -A app.workers.celery_app worker --loglevel=info -E --concurrency=2"
volumes:
- .:/app
env_file:
- .env
depends_on:
- db
- redis
restart: always
# 5. Monitoring Dashboard (Flower)
flower:
image: mher/flower
container_name: star_flower
command: celery --broker=${REDIS_URL} flower
ports:
- "5555:5555"
depends_on:
- redis
restart: always
volumes:
postgres_data: