-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
81 lines (77 loc) · 2.02 KB
/
docker-compose.yml
File metadata and controls
81 lines (77 loc) · 2.02 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
services:
mongodb:
image: mongo:7
container_name: node-prototype-mongodb
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: node-prototype
volumes:
- mongodb_data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
rabbitmq:
image: rabbitmq:3.12-management-alpine
container_name: node-prototype-rabbitmq
restart: unless-stopped
ports:
- "5672:5672" # AMQP port
- "15672:15672" # Management UI port
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: password
RABBITMQ_DEFAULT_VHOST: /
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
api:
build:
context: .
dockerfile: Dockerfile
container_name: node-prototype-api
restart: unless-stopped
ports:
- "3000:3000"
environment:
PORT: 3000
MONGODB_URI: mongodb://admin:password@mongodb:27017/node-prototype?authSource=admin
MONGODB_DB_NAME: node-prototype
RABBITMQ_URI: amqp://admin:password@rabbitmq:5672
NODE_ENV: production
depends_on:
mongodb:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- app-network
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => {let d='';r.on('data',c=>d+=c);r.on('end',()=>process.exit(r.statusCode===200?0:1))})"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
mongodb_data:
driver: local
rabbitmq_data:
driver: local
networks:
app-network:
driver: bridge