Files
SmsReceiver-go/docker-compose.production.yml
OpenClaw Agent 05a39bd495 feat(docker): 添加生产环境 Docker Compose 配置
- 使用预编译镜像 ouaone/sms-receiver-go:latest
- 自动数据卷挂载(data/ 和 logs/)
- 只读配置文件挂载
- 健康检查和资源限制配置
- 完整的使用说明文档
2026-02-12 11:13:39 +08:00

98 lines
2.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SmsReceiver-go 生产环境 Docker Compose 配置
# 使用预编译好的 Docker 镜像,无需本地编译
#
# 快速启动:
# 1. 复制配置文件cp config.example.yaml config.yaml
# 2. 根据需要修改 config.yaml数据库路径、API Token 等)
# 3. 启动服务docker compose -f docker-compose.production.yml up -d
#
# 访问地址http://localhost:28001
# 默认账号admin / admin123
services:
sms-receiver:
# 使用 Docker Hub 上的预编译镜像
image: ouaone/sms-receiver-go:latest
# 或指定版本image: ouaone/sms-receiver-go:v2.0.2
container_name: sms-receiver-go
# 自动重启策略
restart: unless-stopped
# 端口映射
ports:
- "28001:28001"
# 数据卷挂载
volumes:
# 数据库目录(容器内 /app/data
- ./data:/app/data
# 日志目录(容器内 /app/logs
- ./logs:/app/logs
# 配置文件(只读挂载)
- ./config.yaml:/app/config.yaml:ro
# 环境变量
environment:
- TZ=Asia/Shanghai
# 健康检查
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:28001/health"]
interval: 30s # 每 30 秒检查一次
timeout: 3s # 超时时间 3 秒
retries: 3 # 失败 3 次后标记为不健康
start_period: 5s # 容器启动后 5 秒开始检查
# 网络
networks:
- sms-network
# 资源限制(可选)
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
reservations:
cpus: '0.1'
memory: 32M
networks:
sms-network:
driver: bridge
# 使用说明:
#
# 1. 首次使用前,创建配置文件:
# cp config.example.yaml config.yaml
#
# 2. 编辑 config.yaml 配置:
# - data_path: /app/data (数据库名称,无需修改)
# - admin_password: admin123 (修改为强密码,或使用 password_hash
# - api_tokens: 添加你的 TranspondSms APP 的 Token 配置
#
# 3. 启动服务:
# docker compose -f docker-compose.production.yml up -d
#
# 4. 查看日志:
# docker compose -f docker-compose.production.yml logs -f
#
# 5. 停止服务:
# docker compose -f docker-compose.production.yml down
#
# 6. 更新镜像:
# docker compose -f docker-compose.production.yml pull
# docker compose -f docker-compose.production.yml up -d
#
# 目录结构示例:
# SmsReceiver-go/
# ├── docker-compose.production.yml (本文件)
# ├── config.yaml (配置文件,需自行创建)
# ├── config.example.yaml (配置示例)
# ├── data/ (自动创建,存放数据库)
# └── logs/ (自动创建,存放日志)