-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
75 lines (71 loc) · 1.72 KB
/
docker-compose.yml
File metadata and controls
75 lines (71 loc) · 1.72 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
services:
# Redis 缓存服务
redis:
image: redis:7-alpine
container_name: microservice-redis
ports:
- "6379:6379"
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 3s
retries: 5
networks:
- microservice-network
# 用户认证服务
user-service:
build:
context: .
dockerfile: user_service/Dockerfile
container_name: microservice-user-service
ports:
- "8000:8000"
volumes:
- ./user_service/data:/app/user_service/data
environment:
- DATABASE_URL=sqlite+aiosqlite:///./data/users.sqlite3
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/docs" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
networks:
- microservice-network
# 待办事项业务服务
todo-service:
build:
context: .
dockerfile: todo_service/Dockerfile
container_name: microservice-todo-service
ports:
- "8001:8001"
volumes:
- ./todo_service/data:/app/todo_service/data
environment:
- DATABASE_URL=sqlite+aiosqlite:///./data/todos.sqlite3
- REDIS_HOST=redis
- REDIS_PORT=6379
- USER_SERVICE_URL=http://user-service:8000
depends_on:
redis:
condition: service_healthy
user-service:
condition: service_started
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8001/docs" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
networks:
- microservice-network
networks:
microservice-network:
driver: bridge
volumes:
redis_data:
driver: local