forked from milangree/Telegram_ChatBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
61 lines (58 loc) · 2.14 KB
/
Copy pathdocker-compose.yml
File metadata and controls
61 lines (58 loc) · 2.14 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
# Telegram ChatBot — Docker Compose 配置
# 用法: docker compose up -d
#
# 环境变量说明:
# PORT - 服务端口(默认 3000)
# KV_FILE - KV 存储 SQLite 文件路径
# D1_FILE - D1 存储 SQLite 文件路径
# DATABASE_URL - PostgreSQL/MySQL 连接字符串(启用 Hyperdrive)
# ACTIVE_DB - 默认存储后端:kv / d1 / hyperdrive
services:
telegram-chatbot:
image: kakuwari/tg-chatbot:latest
container_name: telegram-chatbot
restart: unless-stopped
ports:
- "3000:3000"
environment:
- PORT=3000
- NODE_ENV=production
# 初始管理员账号(可选,仅首次启动有效)
# 设置后使用指定密码创建初始管理员;未设置则自动生成并在日志中明文打印一次
# - ADMIN_USERNAME=admin
# - ADMIN_PASSWORD=your_secure_password
# 可选:跨域管理后台白名单(逗号分隔)
# - CORS_ORIGIN=https://admin.example.com
# HTTPS 反代时开启 Cookie Secure
# - COOKIE_SECURE=1
# 存储配置 — 默认使用 KV(SQLite 文件)
- KV_FILE=/app/data/kv-store.db
- D1_FILE=/app/data/d1-store.db
- ACTIVE_DB=${ACTIVE_DB:-kv}
# 如需使用 PostgreSQL,取消注释以下行:
# - DATABASE_URL=postgresql://user:password@postgres:5432/telegram_bot
# - ACTIVE_DB=hyperdrive
volumes:
- telegram-chatbot-data:/app/data
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/auth/status"]
interval: 30s
timeout: 3s
start_period: 10s
retries: 3
# ── 可选:PostgreSQL 后端(如需使用 Hyperdrive)────────────────────
# postgres:
# image: postgres:16-alpine
# container_name: telegram-chatbot-db
# restart: unless-stopped
# environment:
# POSTGRES_DB: telegram_bot
# POSTGRES_USER: telegram
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-telegram_password}
# volumes:
# - postgres-data:/var/lib/postgresql/data
# ports:
# - "5432:5432"
volumes:
telegram-chatbot-data:
# postgres-data: