-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
149 lines (141 loc) · 3.07 KB
/
docker-compose.yml
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
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- '5000:5000'
volumes:
- ./backend:/app/backend
- ./backend/uploads:/app/backend/uploads
- ./backend/logs:/app/backend/logs
env_file:
- .env.docker
command: >
sh -c "while ! nc -z db 5432; do
echo 'Waiting for database to be ready...'
sleep 2
done &&
cd /app/backend &&
if [ ! -d migrations ]; then
flask db init
fi &&
flask db migrate -m 'Initial migration' &&
flask db upgrade &&
flask run --host=0.0.0.0"
depends_on:
- db
- redis
networks:
- harmonic_network
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:5000/health']
interval: 30s
timeout: 10s
retries: 3
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- '3000:3000'
volumes:
- ./frontend:/app
- /app/node_modules
environment:
- VITE_API_URL=http://localhost:5000
- VITE_WS_URL=ws://localhost:5000/ws
depends_on:
- backend
networks:
- harmonic_network
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000']
interval: 30s
timeout: 10s
retries: 3
db:
image: postgres:13-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
env_file:
- .env.docker
ports:
- '5432:5432'
networks:
- harmonic_network
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- '6379:6379'
volumes:
- redis_data:/data
networks:
- harmonic_network
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 5s
retries: 5
celery:
build:
context: ./backend
dockerfile: Dockerfile
command: celery -A app.celery worker --loglevel=info
volumes:
- ./backend:/app/backend
env_file:
- .env.docker
environment:
- PYTHONPATH=/app/backend
depends_on:
- redis
- backend
networks:
- harmonic_network
celery-beat:
build:
context: ./backend
dockerfile: Dockerfile
command: celery -A app.celery beat --loglevel=info
volumes:
- ./backend:/app/backend
env_file:
- .env.docker
environment:
- PYTHONPATH=/app/backend
depends_on:
- redis
- backend
networks:
- harmonic_network
flower:
build:
context: ./backend
dockerfile: Dockerfile
command: celery -A app.celery flower --port=5555
ports:
- '5555:5555'
volumes:
- ./backend:/app/backend
env_file:
- .env.docker
environment:
- PYTHONPATH=/app/backend
depends_on:
- redis
- backend
- celery
networks:
- harmonic_network
volumes:
postgres_data:
redis_data:
networks:
harmonic_network:
driver: bridge