-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
72 lines (67 loc) · 1.55 KB
/
docker-compose.yml
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
version: '3.8'
services:
# API 服务
api:
build:
context: .
dockerfile: Dockerfile
container_name: api-monkey-tester
ports:
- "8080:8080"
environment:
- TZ=Asia/Shanghai
- MONGODB_URI=mongodb://admin:password123@mongodb:27017
volumes:
- ./logs:/app/logs
depends_on:
mongodb:
condition: service_healthy
networks:
- monkey-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
# MongoDB 服务
mongodb:
image: mongo:latest
container_name: mongodb
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=password123
volumes:
- mongodb_data:/data/db
networks:
- monkey-net
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
# MongoDB Web ���理界面
mongo-express:
image: mongo-express:latest
container_name: mongo-express
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password123
- ME_CONFIG_MONGODB_SERVER=mongodb
depends_on:
mongodb:
condition: service_healthy
networks:
- monkey-net
restart: unless-stopped
volumes:
mongodb_data:
networks:
monkey-net:
driver: bridge