Hugging Face Deploy commited on
Commit
0ddba4e
·
0 Parent(s):

Initial ClawDBot Docker space

Browse files
Files changed (2) hide show
  1. Dockerfile +31 -0
  2. README.md +164 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-bookworm
2
+
3
+ WORKDIR /app
4
+
5
+ # Enable modern package managers (optional but harmless)
6
+ RUN corepack enable
7
+
8
+ # Install Clawdbot CLI (includes Gateway + Web UI)
9
+ RUN npm install -g clawdbot@latest \
10
+ && mkdir -p /data/config /data/workspace /data/state
11
+
12
+ # Runtime directories for config and state
13
+ ENV CLAWDBOT_CONFIG_DIR=/data/config
14
+ ENV CLAWDBOT_WORKSPACE_DIR=/data/workspace
15
+ ENV CLAWDBOT_STATE_DIR=/data/state
16
+
17
+ # Default environment (Hugging Face Spaces overrides PORT)
18
+ ENV NODE_ENV=production
19
+ ENV PORT=7860
20
+
21
+ # Clawdbot honors CLAWBOT_GATEWAY_PORT for the Gateway HTTP/WebSocket port
22
+ ENV CLAWBOT_GATEWAY_PORT=${PORT}
23
+
24
+ # Expose HTTP port for Spaces / local Docker
25
+ EXPOSE 7860
26
+
27
+ # Start Gateway bound to LAN, using PORT (or 7860) and allowing first-run
28
+ # without a prewritten config file. Auth/token should be configured via
29
+ # env vars or config once the Space is up.
30
+ CMD ["sh", "-c", "export CLAWBOT_GATEWAY_PORT=${PORT:-7860}; clawdbot gateway --bind lan --port ${PORT:-7860} --allow-unconfigured --verbose"]
31
+
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ClawDBot Gateway on Hugging Face (Docker)
3
+ emoji: "🦞"
4
+ colorFrom: red
5
+ colorTo: yellow
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ # ClawDBot 在 Hugging Face 上的 Docker 部署
11
+
12
+ 这个目录包含一个最小化的 Docker 配置,用来在 Hugging Face Spaces 上运行 ClawDBot Gateway。
13
+
14
+ 你可以:
15
+
16
+ - 本地用 Docker 启动并访问 ClawDBot 网页控制台
17
+ - 将本目录推送到 Hugging Face `spaces` 仓库(如 `acpr123/clawdbot`)并在线运行
18
+
19
+ > 注意:请**不要**把任何私密 Token(例如 Hugging Face Token、OpenAI / Anthropic API Key 等)提交到 Git 仓库,而是通过 Hugging Face 的 Secrets 或本地环境变量注入。
20
+
21
+ ---
22
+
23
+ ## 1. 本地构建与运行
24
+
25
+ 在 `0126project` 目录下:
26
+
27
+ ```bash
28
+ cd /home/luck/xzy/0126project
29
+
30
+ docker build -t clawdbot-hf .
31
+
32
+ docker run \
33
+ -p 7860:7860 \
34
+ -e CLAWBOT_GATEWAY_TOKEN="your-gateway-token" \
35
+ --name clawdbot-hf \
36
+ clawdbot-hf
37
+ ```
38
+
39
+ 然后在浏览器打开:
40
+
41
+ ```text
42
+ http://localhost:7860
43
+ ```
44
+
45
+ 首次启动时,容器会:
46
+
47
+ - 使用 `npm install -g clawdbot@latest` 安装最新版 ClawDBot
48
+ - 在容器内部启动 Gateway(Web UI + WebSocket)
49
+ - 监听 `PORT`(默认 7860,对应 Hugging Face Spaces 的默认端口)
50
+
51
+ 如需持久化配置和会话,可以绑定本地目录到容器的 `/data`:
52
+
53
+ ```bash
54
+ docker run \
55
+ -p 7860:7860 \
56
+ -e CLAWBOT_GATEWAY_TOKEN="your-gateway-token" \
57
+ -v "$PWD/data:/data" \
58
+ --name clawdbot-hf \
59
+ clawdbot-hf
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 2. 推送到 Hugging Face Spaces(以 `acpr123` 为例)
65
+
66
+ 1. 在 Hugging Face 网页上创建一个新的 **Space**:
67
+ - Owner:`acpr123`
68
+ - Space 名称:例如 `clawdbot`
69
+ - SDK:选择 **Docker**
70
+
71
+ 2. 在本机初始化 Git 仓库(在 `0126project` 下):
72
+
73
+ ```bash
74
+ cd /home/luck/xzy/0126project
75
+ git init
76
+ git add .
77
+ git commit -m "Initial ClawDBot Docker space"
78
+ ```
79
+
80
+ 3. 将 Hugging Face Space 作为远程仓库添加(URL 示例):
81
+
82
+ ```bash
83
+ git remote add origin https://huggingface.co/spaces/acpr123/clawdbot
84
+ ```
85
+
86
+ 4. 使用你的 Hugging Face 账户凭证(用户名 + Token)推送代码:
87
+
88
+ ```bash
89
+ git push -u origin main # 或 master,视你本地默认分支而定
90
+ ```
91
+
92
+ 推送时会提示输入用户名和密码:
93
+
94
+ - 用户名:`acpr123`
95
+ - 密码:你的 Hugging Face Access Token(形如 `hf_...`)
96
+
97
+ > 不要在本仓库的任何文件中明文写入 Token;仅在 Git 推送认证或 HF 控制台的 Secrets 中使用。
98
+
99
+ 5. 推送完成后,Hugging Face 会自动根据 `Dockerfile` 构建镜像并启动 Space。构建完成后,访问 Space 页面即可打开 ClawDBot 控制台。
100
+
101
+ ---
102
+
103
+ ## 3. 在 Hugging Face 配置环境变量 / Secrets
104
+
105
+ 在 Space 的 **Settings → Variables and secrets** 中添加:
106
+
107
+ - `CLAWDBOT_GATEWAY_TOKEN`(Secret)
108
+ - 用作 Gateway 控制台登录 Token
109
+ - 建议设置为随机长字符串
110
+
111
+ - 模型相关 API Key(按需):
112
+ - `ANTHROPIC_API_KEY`
113
+ - `OPENAI_API_KEY`
114
+ - `GOOGLE_API_KEY`(Gemini)
115
+ - 其他你计划使用的模型提供商 Key
116
+
117
+ 在容器内,ClawDBot 会自动读取这些环境变量,无需修改代码。
118
+
119
+ > 提示:Hugging Face 上设置为 **Secrets** 的变量不会出现在构建日志中,也不会存入仓库。
120
+
121
+ ---
122
+
123
+ ## 4. `.env` 示例(本地开发可选)
124
+
125
+ 如果你想在本地用 `docker run --env-file .env` 的方式启动,可以在本目录下创建 `.env` 文件,例如:
126
+
127
+ ```env
128
+ PORT=7860
129
+
130
+ # ClawDBot Gateway 安全 Token(用于控制台登录)
131
+ CLAWDBOT_GATEWAY_TOKEN=your-gateway-token
132
+
133
+ # 可选:模型提供商配置
134
+ ANTHROPIC_API_KEY=sk-ant-...
135
+ OPENAI_API_KEY=sk-openai-...
136
+ GOOGLE_API_KEY=AIza...
137
+ ```
138
+
139
+ > 再次强调:**不要**提交实际的密钥到任何公共仓库。
140
+
141
+ ---
142
+
143
+ ## 5. 目录说明
144
+
145
+ 当前仓库仅包含运行 ClawDBot Gateway 所需的最小 Docker 配置:
146
+
147
+ - `Dockerfile`:构建使用最新 npm 版本 ClawDBot 的镜像
148
+ - `README.md`:本说明文档
149
+
150
+ ClawDBot 自身的代码和 UI 由 `npm install -g clawdbot@latest` 在镜像构建时自动获取,无需手动拷贝源码。
151
+
152
+ ---
153
+
154
+ ## 6. 后续可扩展方向
155
+
156
+ - 在 `/data/workspace` 中挂载自定义 `AGENTS.md` / `SOUL.md` / `USER.md` / `MEMORY.md` 等,打造专属 Lobster Personality
157
+ - 通过 ClawDBot 控制台配置 WhatsApp / Telegram / Slack / Discord 等消息渠道
158
+ - 配置本地模型或其他托管模型,实现多模型路由
159
+
160
+ 如果你需要,我也可以在本目录中再补一份:
161
+
162
+ - **一页式部署速查表(中文版)**
163
+ - 或按 **Windows / macOS / Linux** 分平台的推送与调试说明
164
+