-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
80 lines (73 loc) · 1.85 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
version: '3.8'
services:
postgres:
image: postgres:14
container_name: postgres
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
networks:
- my_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB > /var/log/pg_healthcheck.log 2>&1"]
interval: 10s
retries: 5
start_period: 5s
timeout: 5s
volumes:
- postgres_data:/var/lib/postgresql/data
fastapi:
build:
context: ./backend
dockerfile: Dockerfile
container_name: fastapi
ports:
- "8000:8000"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
depends_on:
postgres:
condition: service_healthy
networks:
- my_network
restart: unless-stopped
command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
interval: 10s
retries: 3
start_period: 5s
timeout: 5s
volumes:
- ./backend/data:/app/data
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3002:3000"
networks:
- my_network
environment:
GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER}
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
GF_LOG_LEVEL: error
volumes:
- grafana-data:/var/lib/grafana
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000 || exit 1"]
interval: 10s
retries: 3
start_period: 5s
timeout: 5s
networks:
my_network:
driver: bridge
volumes:
postgres_data:
grafana-data: