feat: add CentOS7 single executable build

This commit is contained in:
shiyue
2026-06-24 10:36:03 +08:00
parent a794607817
commit 67914ba10f
8 changed files with 365 additions and 26 deletions

View File

@@ -119,6 +119,29 @@ Codex App 原生协作工具会被转成页面上的子代理状态卡片:
- npm
- 已安装并登录需要使用的 Agent CLI
源码方式运行需要 Node.js >= 18。Node.js 版本过低时,可先执行:
```bash
# 已安装 nvm 时,使用当前 LTS 版本
nvm install --lts
nvm use --lts
node -v
# Ubuntu / Debian / WSL可固定安装 Node.js 22root 用户可去掉 sudo
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
# RHEL / Rocky / AlmaLinux 8/9可固定安装 Node.js 22root 用户可去掉 sudo
curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -
sudo dnf install -y nodejs || sudo yum install -y nodejs
node -v
```
CentOS 7 这类老系统通常停在 `glibc 2.17`NodeSource Node.js 22 RPM 会要求
`glibc >= 2.28`,不要在这台机器上硬装。老系统部署请使用下面的
**Bun single executable** 方式。
```bash
npm install -g @anthropic-ai/claude-code
npm install -g @openai/codex
@@ -162,6 +185,44 @@ npm start
http://localhost:8002
```
### CentOS 7 / 老 glibc
hapi 能在 CentOS 7 上运行,不是因为它在 CentOS 7 上安装了新版 Node而是因为
它在构建机用 `bun build --compile --target=bun-linux-x64-baseline` 产出 baseline
单文件二进制。cc-web 也按这个思路提供发布包构建。
在较新的 Linux 构建机或 CI 上执行:
```bash
npm install
npm run build:single-exe
```
默认会生成:
```text
dist-exe/bun-linux-x64-baseline/
```
把这个目录整体拷贝到 CentOS 7 后直接运行:
```bash
cd /opt/cc-web
chmod +x cc-web
PORT=8002 CC_WEB_PASSWORD='请改成强密码' ./cc-web
```
这个发布包只包含 cc-web 服务本体和前端资源,**不会把 Claude/Codex CLI 打进包里**。
运行时仍调用宿主机上的 CLI
```bash
export CLAUDE_PATH=/usr/local/bin/claude
export CODEX_PATH=/usr/local/bin/codex
PORT=8002 CC_WEB_PASSWORD='请改成强密码' ./cc-web
```
如果不设置 `CLAUDE_PATH` / `CODEX_PATH`,默认仍从宿主机 `PATH` 查找 `claude``codex`
### Windows
```cmd