@@ -77,8 +77,10 @@ make clean-volumes # 清理所有数据卷 (危险!)
7777| Service | Port | Description |
7878| ---------------- | ----- | ------------------------------- |
7979| openclaw-gateway | 18789 | 主网关服务 (Web UI + WebSocket) |
80- | HTTP Proxy | 7897 | 代理服务 (访问外网) |
81- | Claude API Proxy | 15721 | Claude API 代理 |
80+ | | 18790 | Bridge WebSocket 桥接 |
81+ | | 18791 | Browser 浏览器调试端口 |
82+
83+ > ** 代理配置** : 通过 ` HTTP_PROXY ` /` HTTPS_PROXY ` 环境变量配置外部代理,用于访问 Google 和 Claude API
8284
8385## Docker Image Variants
8486
@@ -133,8 +135,46 @@ GITHUB_TOKEN=xxx
133135- Gateway 日志位于容器内 ` /tmp/openclaw-gateway.log `
134136- 进入容器后可直接运行 ` openclaw ` 命令
135137
138+ ### CI 调试命令
139+
140+ ``` bash
141+ # 查看最近的 CI 运行
142+ gh run list --repo hrygo/openclaw-devkit --limit 5
143+
144+ # 查看特定运行的详细信息
145+ gh run view < run-id> --repo hrygo/openclaw-devkit
146+
147+ # 获取完整 CI 日志
148+ gh run view < run-id> --repo hrygo/openclaw-devkit --log
149+
150+ # 搜索日志中的错误
151+ gh run view < run-id> --repo hrygo/openclaw-devkit --log 2>&1 | grep -E " (ERROR|failed|process \" )"
152+ ```
153+
136154## Gotchas
137155
156+ ### Shell 条件执行陷阱 (Dockerfile)
157+
158+ ** 问题** : 在 Dockerfile RUN 命令中使用 ` && ` 链时,条件测试 ` [ condition ] && cmd ` 如果返回 false 会中断整个链条。
159+
160+ ** 错误示例** :
161+ ``` dockerfile
162+ RUN ARCH=$(dpkg --print-architecture) && \
163+ JUST_ARCH="${ARCH}" && \
164+ [ "$ARCH" = "amd64" ] && JUST_ARCH="x86_64" && \ # 如果 ARCH=arm64,这里不会执行
165+ [ "$ARCH" = "arm64" ] && JUST_ARCH="aarch64" && \ # 如果 ARCH=amd64,这里断链!
166+ curl ... # 不会执行
167+ ```
168+
169+ ** 正确做法** : 使用 ` if-then-elif-else-fi ` 语法:
170+ ``` dockerfile
171+ RUN ARCH=$(dpkg --print-architecture) && \
172+ if [ "$ARCH" = "amd64" ]; then JUST_ARCH="x86_64" ; \
173+ elif [ "$ARCH" = "arm64" ]; then JUST_ARCH="aarch64" ; \
174+ else JUST_ARCH="${ARCH}" ; fi && \
175+ curl ...
176+ ```
177+
138178### Shell 脚本换行符问题
139179
140180** 症状** : 执行 ` make up ` 时报错 ` env: 'bash\r': No such file or directory `
@@ -173,6 +213,20 @@ git diff --check
173213
174214## Dockerfile Development
175215
216+ ### 工具架构映射表
217+
218+ 不同工具使用不同的架构命名约定,需要正确映射:
219+
220+ | 工具 | amd64 命名 | arm64 命名 | 示例 URL |
221+ | ------| -----------| -----------| ----------|
222+ | yq | ` amd64 ` | ` arm64 ` | ` yq_linux_amd64 ` |
223+ | just | ` x86_64 ` | ` aarch64 ` | ` just-1.47.0-x86_64-unknown-linux-musl.tar.gz ` |
224+ | lazygit | ` x86_64 ` | ` arm64 ` | ` lazygit_0.49.0_Linux_x86_64.tar.gz ` |
225+ | gh CLI | ` amd64 ` | ` arm64 ` | ` gh_2.67.0_linux_amd64.deb ` |
226+ | Go | ` amd64 ` | ` arm64 ` | ` go1.26.1.linux-arm64.tar.gz ` |
227+
228+ ** 推荐** : 在 RUN 命令中使用 ` if-then-else-fi ` 处理架构差异。
229+
176230### Version Verification
177231Before using specific versions in Dockerfile, verify download URLs exist:
178232``` bash
@@ -191,6 +245,21 @@ docker build --check -f Dockerfile . # Validate without full build
191245- golangci-lint: 1.64.x
192246- Java: 21 LTS (via Eclipse Temurin)
193247
248+ ### 版本锁定原则
249+
250+ ** 必须锁定版本** : 所有工具版本必须锁定,避免因上游更新导致构建失败。
251+
252+ ``` bash
253+ # ❌ 错误: 动态查询最新版本 (消耗 GitHub API 配额,易触发 rate limit)
254+ LATEST=$( curl -s https://api.github.com/repos/foo/bar/releases/latest | jq -r ' .tag_name' )
255+
256+ # ✅ 正确: 锁定具体版本
257+ ARG TOOL_VERSION=1.2.3
258+ curl -fsSL " https://github.com/foo/bar/releases/download/v${TOOL_VERSION} /..."
259+ ```
260+
261+ ** 好处** : 可重复构建 + 避免 API rate limit + 便于追踪回滚
262+
194263### Installation Methods
195264- ** Node.js** : Use NodeSource APT repository (not direct nodejs.org download)
196265 - More reliable for multi-architecture builds (amd64 + arm64)
0 commit comments