forked from Nsanjayboruds/RIVETO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
79 lines (74 loc) · 1.81 KB
/
docker-compose.yml
File metadata and controls
79 lines (74 loc) · 1.81 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
version: '3.8'
services:
# MongoDB Service (Secured & Reliable)
mongo:
image: mongo:7.0 # <--- PINNED VERSION (was latest)
container_name: riveto_mongo
restart: always
ports:
- "27017:27017"
environment:
# <--- AUTHENTICATION ADDED
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: examplepassword
volumes:
- mongo-data:/data/db
networks:
- riveto-network
# <--- HEALTH CHECK ADDED
# This checks if Mongo is actually ready to accept connections
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 40s
# <--- RESOURCE LIMITS ADDED
deploy:
resources:
limits:
cpus: '1.0' # Max 1 CPU core
memory: 1G # Max 1GB RAM
reservations:
memory: 256M # Guarantees at least 256MB
# Backend Service
backend:
build: ./backend
container_name: riveto_backend
ports:
- "5000:5000"
volumes:
- ./backend:/app
- /app/node_modules
env_file:
- ./backend/.env
environment:
# <--- UPDATED URI WITH AUTH CREDENTIALS
- MONGO_URI=mongodb://root:examplepassword@mongo:27017/riveto?authSource=admin
depends_on:
mongo:
condition: service_healthy # <--- WAITS FOR HEALTH CHECK
networks:
- riveto-network
# Frontend Service
frontend:
build: ./frontend
container_name: riveto_frontend
ports:
- "3000:5173"
volumes:
- ./frontend:/app
- /app/node_modules
env_file:
- ./frontend/.env
stdin_open: true
tty: true
depends_on:
- backend
networks:
- riveto-network
volumes:
mongo-data:
networks:
riveto-network:
driver: bridge