From b39a28236a127a5aa1f6f1dd0d615103996d1083 Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Mon, 2 Feb 2026 17:23:06 +0800 Subject: [PATCH] =?UTF-8?q?build(moltbot):=20=E6=B7=BB=E5=8A=A0=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=8E=AF=E5=A2=83docker=20compose=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加moltbot的生产环境docker compose配置文件,包含容器配置、资源限制和健康检查 --- moltbot/stack.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 moltbot/stack.yml diff --git a/moltbot/stack.yml b/moltbot/stack.yml new file mode 100644 index 0000000..e8fbe57 --- /dev/null +++ b/moltbot/stack.yml @@ -0,0 +1,33 @@ + +services: + moltbot: + container_name: moltbot-prod + image: xxx.xuanyuan.run/moltbot/moltbot:v1.0.0 # 锁定稳定版本 + restart: unless-stopped + user: "1000:1000" + ports: + - "127.0.0.1:18789:18789" + - "127.0.0.1:18791:18791" + volumes: + - /data/moltbot:/home/moltbot/.clawdbot + - /data/moltbot/logs:/home/moltbot/.clawdbot/logs + - /data/moltbot/credentials:/home/moltbot/.clawdbot/credentials + env_file: + - .env.moltbot + # 资源限制配置(注意:非Swarm模式下deploy.resources不生效) + deploy: + resources: + limits: + cpus: '4' + memory: 8G + # 健康检查(兼容无curl场景,修正CMD语法风险,采用CMD-SHELL支持shell运算符) + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:18789/health >/dev/null || exit 1"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s # 给服务启动预留时间 + # 非Swarm模式资源限制补充(mem_limit/cpus 兼容普通docker compose) + mem_limit: 8g + memswap_limit: 8g + cpus: '4' \ No newline at end of file