-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
66 lines (54 loc) · 1.37 KB
/
Copy pathdocker-compose.yml
File metadata and controls
66 lines (54 loc) · 1.37 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
services:
rainmail:
build:
context: .
dockerfile: Dockerfile
image: rainmail:latest
container_name: rainmail
# 端口映射:仅开放5024
ports:
- "5024:5024"
# 使用默认bridge网络,不使用host网络
# 这样容器无法访问宿主机网络
# 环境变量
environment:
- TZ=Asia/Shanghai
# 从 .env 文件加载配置(必需)
env_file:
- .env
# 数据卷挂载:SQLite 数据库持久化(数据库文件位于 instance/rainmail.db)
volumes:
- rainmail_instance:/app/instance
# tmpfs用于运行时写入
tmpfs:
- /tmp
# 重启策略
restart: unless-stopped
# 健康检查
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5024/api/health"]
interval: 30s
timeout: 3s
start_period: 5s
retries: 3
# 资源限制(防止资源耗尽攻击)
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
networks:
- isolated_net
# 定义数据卷
volumes:
rainmail_instance:
driver: local
networks:
isolated_net:
driver: bridge
driver_opts:
# 强制将宿主机上的虚拟网卡命名为 br-rainmail,方便固定 iptables 规则
com.docker.network.bridge.name: br-rainmail