-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
42 lines (40 loc) · 1 KB
/
docker-compose.test.yml
File metadata and controls
42 lines (40 loc) · 1 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
services:
mongodb-test:
image: mongo:7.0
container_name: mongodb-test-rs
command: ["mongod", "--replSet", "rs0", "--bind_ip_all", "--quiet"]
ports:
- "27017:27017"
environment:
- MONGO_INITDB_DATABASE=test-db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
restart: "no"
tmpfs:
- /data/db
mongodb-test-init:
image: mongo:7.0
depends_on:
mongodb-test:
condition: service_healthy
restart: "no"
network_mode: "host"
command: >
mongosh --host localhost:27017 --quiet --eval "
try {
rs.initiate({
_id: 'rs0',
members: [{ _id: 0, host: 'localhost:27017' }]
});
print('Test replica set initiated');
} catch(e) {
print('Test replica set already initiated');
}
"
networks:
default:
name: express-server-test-network