feat: 添加 Gitea webhook 自动部署功能

- 新增独立的 webhook 服务 (Go, 端口 9000)
- HMAC-SHA256 签名验证
- 零停机热更新部署
- 自动清理旧镜像
- 完整配置文档 WEBHOOK_SETUP.md
- 精简 README 版本历史为表格形式
This commit is contained in:
CHE LIANG ZHAO
2026-01-13 14:37:01 +08:00
parent 471bdeaf6b
commit 05ab270677
9 changed files with 1062 additions and 22 deletions

View File

@@ -125,3 +125,31 @@ services:
depends_on:
mongodb:
condition: service_healthy
# Gitea Webhook 服务 - 自动部署
webhook:
build:
context: ./webhook
dockerfile: Dockerfile
container_name: billai-webhook
restart: unless-stopped
ports:
- "9000:9000"
environment:
WEBHOOK_PORT: "9000"
# 重要:更改此 Secret 为强随机值
# 生成方法: openssl rand -hex 32
WEBHOOK_SECRET: "change-this-to-your-secret-key"
REPO_PATH: "/app"
volumes:
# 挂载 Docker Socket 以支持容器操作
- /var/run/docker.sock:/var/run/docker.sock
# 挂载仓库目录
- /path/to/billai:/app
working_dir: /app
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s