-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
80 lines (75 loc) · 1.77 KB
/
docker-compose.yml
File metadata and controls
80 lines (75 loc) · 1.77 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
version: '3.8'
services:
mongodb:
image: mongo:7
container_name: todo-mongodb
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
MONGO_INITDB_DATABASE: todo_db
volumes:
- mongo-data:/data/db
- mongo-config:/data/configdb
networks:
- todo-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: todo-backend
restart: unless-stopped
ports:
- "8080:8080"
env_file:
- .env
environment:
SPRING_DATA_MONGODB_URI: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@mongodb:27017/todo_db?authSource=admin
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRATION: 86400000
IA_API_KEY: ${IA_API_KEY}
depends_on:
mongodb:
condition: service_healthy
networks:
- todo-network
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 8080"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# React Frontend
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: todo-frontend
restart: unless-stopped
ports:
- "80:80"
depends_on:
backend:
condition: service_healthy
networks:
- todo-network
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:80 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
todo-network:
driver: bridge
volumes:
mongo-data:
mongo-config: