-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
141 lines (133 loc) · 3.49 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
141 lines (133 loc) · 3.49 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
# Development configuration (alias for docker-compose.yml)
# Usage: docker-compose -f docker-compose.dev.yml up -d
#
# This file is identical to docker-compose.yml for explicit naming preference.
# Use docker-compose.yml for default development.
services:
app:
build:
context: ./backend
dockerfile: Dockerfile
image: proj2_backend:dev
container_name: proj2_backend
ports:
- "8000:8000"
volumes:
- ./backend/app:/app/app:ro
- ./backend/cli:/app/cli:ro
- media_data:/app/media
# email/templates.py reads pre-compiled HTML/text from /app/emails/compiled.
# Build context is ./backend so the dir isn't in the image — mount it.
- ./emails:/app/emails:ro
env_file:
- ./backend/.env
environment:
- DEBUG=true
- ENVIRONMENT=local
- POSTGRES_HOST=db
- REDIS_HOST=redis
- TASKIQ_BROKER_URL=redis://redis:6379/1
- TASKIQ_RESULT_BACKEND=redis://redis:6379/1
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
networks:
- backend
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
labels:
- "prometheus.scrape=true"
- "prometheus.port=8000"
- "prometheus.path=/metrics"
db:
image: postgres:16-alpine
container_name: proj2_db
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-proj2}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- backend
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
container_name: proj2_redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- backend
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
taskiq_worker:
image: proj2_backend:dev
pull_policy: never
container_name: proj2_taskiq_worker
volumes:
- ./backend/app:/app/app:ro
- media_data:/app/media
- ./emails:/app/emails:ro
command: taskiq worker app.worker.taskiq_app:broker --workers 1 --reload
env_file:
- ./backend/.env
environment:
- DEBUG=true
- POSTGRES_HOST=db
- REDIS_HOST=redis
- TASKIQ_BROKER_URL=redis://redis:6379/1
- TASKIQ_RESULT_BACKEND=redis://redis:6379/1
networks:
- backend
depends_on:
app:
condition: service_started
redis:
condition: service_healthy
db:
condition: service_healthy
restart: unless-stopped
taskiq_scheduler:
image: proj2_backend:dev
pull_policy: never
container_name: proj2_taskiq_scheduler
volumes:
- ./backend/app:/app/app:ro
command: taskiq scheduler app.worker.taskiq_app:scheduler
env_file:
- ./backend/.env
environment:
- DEBUG=true
- REDIS_HOST=redis
- TASKIQ_BROKER_URL=redis://redis:6379/1
- TASKIQ_RESULT_BACKEND=redis://redis:6379/1
networks:
- backend
depends_on:
app:
condition: service_started
redis:
condition: service_healthy
restart: unless-stopped
networks:
backend:
driver: bridge
volumes:
media_data:
postgres_data:
redis_data: