-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (77 loc) · 1.61 KB
/
docker-compose.yml
File metadata and controls
82 lines (77 loc) · 1.61 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
version: "3.8"
services:
redis:
image: "redis:7.2.4"
container_name: rediss
networks:
- app-network
expose:
- "6379"
volumes:
- redis-data:/data
command: ["redis-server", "--requirepass", "your_secure_password"]
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
fastapi:
build:
context: .
dockerfile: Dockerfile.prod # Use a production-specific Dockerfile
container_name: fastapi
environment:
- ENV=production
- REDIS_URL=redis://rediss:6379/0
ports:
- "80:8000"
depends_on:
- redis
networks:
- app-network
restart: unless-stopped
deploy:
resources:
limits:
cpus: "1.0"
memory: "512M"
reservations:
cpus: "0.5"
memory: "256M"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
worker:
build:
context: .
dockerfile: Dockerfile.prod
container_name: worker
environment:
- REDIS_URL=redis://rediss:6379/0
command: rq worker
depends_on:
- redis
networks:
- app-network
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.5"
memory: "256M"
reservations:
cpus: "0.25"
memory: "128M"
healthcheck:
test: ["CMD", "rq", "info"]
interval: 30s
timeout: 10s
retries: 3
networks:
app-network:
driver: bridge
volumes:
redis-data: