37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
bot:
|
||
build:
|
||
context: .
|
||
# no_cache: true # 解决问题后请删除此行
|
||
container_name: secure-file-bot
|
||
restart: unless-stopped
|
||
# 告诉 bot 服务在 bot-api 服务启动后再启动
|
||
depends_on:
|
||
- bot-api
|
||
volumes:
|
||
# 路径必须与 bot-api 服务中的路径一致
|
||
- ./local_storage:/app/local_storage
|
||
# 将敏感信息移动到 .env 文件中
|
||
env_file:
|
||
- ./.env
|
||
|
||
bot-api:
|
||
image: telegram/bot-api:latest
|
||
container_name: local-bot-api
|
||
restart: unless-stopped
|
||
# 关键:在这里使用 --local 标志
|
||
command: telegram-bot-api --local --http-port 8081
|
||
ports:
|
||
# (可选) 如果你希望从外部访问API服务器,取消注释下一行
|
||
# - "8081:8081"
|
||
volumes:
|
||
# 路径必须与 bot 服务中的路径一致
|
||
- ./local_storage:/app/local_storage
|
||
# (可选) API 服务器也需要一个工作目录来处理文件
|
||
- ./bot_api_data:/var/lib/telegram-bot-api
|
||
environment:
|
||
# 这些变量将从 .env 文件中读取
|
||
- TELEGRAM_API_ID=${TELEGRAM_API_ID}
|
||
- TELEGRAM_API_HASH=${TELEGRAM_API_HASH} |