-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
121 lines (115 loc) · 2.73 KB
/
docker-compose.yml
File metadata and controls
121 lines (115 loc) · 2.73 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
version: '3.9'
services:
api:
build:
context: ./services/api
dockerfile: Dockerfile
container_name: nba-stats-api
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- PORT=3000
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=nba_stats
- DB_USER=postgres
- DB_PASSWORD=postgres
- LOG_LEVEL=debug
- NBA_API_KEY=${NBA_API_KEY}
- NBA_API_ENDPOINT=${NBA_API_ENDPOINT:-https://api.balldontlie.io/v1}
env_file:
- .env
depends_on:
- postgres
volumes:
- ./services/api:/app
- api_node_modules:/app/node_modules
networks:
- nba-network
healthcheck:
test: ["CMD", "node", "healthcheck.js"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
deploy:
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
labels:
- "com.example.monitoring=true"
- "com.example.service=nba-stats-api"
- "com.example.version=1.0.0"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- VITE_API_URL=http://localhost:3000/api
container_name: nba-stats-frontend
ports:
- "3001:3001"
depends_on:
- api
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
networks:
- nba-network
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
postgres:
image: postgres:15-alpine
container_name: nba-stats-db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=nba_stats
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- nba-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
pgadmin:
image: dpage/pgadmin4:latest
container_name: nba-stats-pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=admin@nba-stats.com
- PGADMIN_DEFAULT_PASSWORD=admin
- PGADMIN_CONFIG_SERVER_JSON_FILE='/pgadmin4/servers.json'
- PGADMIN_CONFIG_ENHANCED_IAM_LOGGING=False
ports:
- "5050:80"
depends_on:
- postgres
volumes:
- ./services/pgadmin/servers.json:/pgadmin4/servers.json
networks:
- nba-network
volumes:
postgres_data:
api_node_modules:
frontend_node_modules:
networks:
nba-network:
driver: bridge