-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
66 lines (62 loc) · 1.49 KB
/
Copy pathdocker-compose.yml
File metadata and controls
66 lines (62 loc) · 1.49 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
version: '3.8'
services:
# FastAPI示例应用
fastapi-example:
build: .
container_name: python3-fastapi-example
ports:
- "8000:8000"
volumes:
- ./examples:/app/examples
- ./utils:/app/utils
command: python examples/intermediate/fastapi_web_app.py
environment:
- PYTHONPATH=/app
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
# 报销系统应用
reimbursement-system:
build: .
container_name: python3-reimbursement-system
ports:
- "8001:8000"
volumes:
- ./projects/reimbursement-system:/app/projects/reimbursement-system
command: python projects/reimbursement-system/main.py
environment:
- PYTHONPATH=/app
depends_on:
- fastapi-example
restart: unless-stopped
# 开发环境(带热重载)
dev:
build: .
container_name: python3-dev
ports:
- "8002:8000"
volumes:
- .:/app
command: uvicorn examples.intermediate.fastapi_web_app:app --host 0.0.0.0 --port 8000 --reload
environment:
- PYTHONPATH=/app
- PYTHONUNBUFFERED=1
stdin_open: true
tty: true
restart: unless-stopped
# 测试环境
test:
build: .
container_name: python3-test
volumes:
- .:/app
command: pytest tests/ -v
environment:
- PYTHONPATH=/app
depends_on:
- fastapi-example
restart: "no"