This repository was archived by the owner on Dec 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (128 loc) · 3.39 KB
/
Copy pathdocker-compose.yml
File metadata and controls
134 lines (128 loc) · 3.39 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# ============================================================
# THE FINALS QQ Bot - Docker Compose 配置
# ============================================================
services:
# ============================================================
# Redis 缓存服务
# ============================================================
redis:
image: redis:7-alpine
container_name: thefinals-redis
restart: unless-stopped
command: >
redis-server
--appendonly yes
--appendfsync everysec
--maxmemory 512mb
--maxmemory-policy allkeys-lru
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- bot-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================================
# QQ Bot 主服务
# ============================================================
bot:
build:
context: .
dockerfile: Dockerfile
args:
- BUILD_DATE=${BUILD_DATE:-now}
- VERSION=${VERSION:-latest}
image: thefinals-qqbot:latest
container_name: thefinals-bot
restart: unless-stopped
depends_on:
redis:
condition: service_healthy
ports:
- "8080:8080"
volumes:
# 配置文件 (只读) - 使用 Docker 专用配置
- ./config/docker.config.yaml:/app/config/config.yaml:ro
# 数据持久化
- ./data:/app/data
# 日志
- ./logs:/app/logs
# 静态资源 (临时图片)
- ./static/temp_images:/app/static/temp_images
environment:
# Python 环境
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
# 时区设置
- TZ=Asia/Shanghai
# Redis 连接 (从配置文件读取,这里可以覆盖)
- REDIS_HOST=redis
- REDIS_PORT=6379
networks:
- bot-network
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
# 资源限制 (可根据需要调整)
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
# ============================================================
# Nginx 反向代理(HTTPS)
# ============================================================
nginx:
image: nginx:alpine
container_name: thefinals-nginx
restart: unless-stopped
depends_on:
- bot
ports:
- "8444:8444"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
networks:
- bot-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================================
# 网络配置
# ============================================================
networks:
bot-network:
driver: bridge
ipam:
config:
- subnet: 172.25.0.0/16
# ============================================================
# 数据卷
# ============================================================
volumes:
redis-data:
driver: local