simler commited on
Commit
a758e1d
·
verified ·
1 Parent(s): bf06375

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -12
Dockerfile CHANGED
@@ -1,41 +1,43 @@
1
- # ⚠️ 必须使用 Node.js 22 (Moltbot 官方要求)
2
  FROM node:22-bullseye-slim
3
 
4
  # 设置工作目录
5
  WORKDIR /app
6
 
7
- # 1. 安装系统基础工具
 
8
  RUN apt-get update && apt-get install -y \
9
  git \
10
  curl \
11
  ca-certificates \
12
  procps \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # 2. 全局安装 pnpm (Moltbot 依赖这个包管理器)
16
  RUN npm install -g pnpm
17
 
18
- # 3. 克隆 Moltbot 官方源码
19
  RUN git clone https://github.com/moltbot/moltbot.git .
20
 
21
- # 4. 安装项目依赖
22
  RUN pnpm install
23
 
24
- # 5. 尝试构建 (防止构建脚本报错卡住,加 || true)
25
- RUN pnpm run build || echo "Build script skipped..."
26
 
27
- # 6. 设置环境变量
28
  ENV GIT_REPO=${GIT_REPO}
29
  ENV GIT_USER=${GIT_USER}
30
  ENV GIT_TOKEN=${GIT_TOKEN}
31
- ENV PORT=7860
 
32
 
33
- # 7. 暴露 HF 端口
34
  EXPOSE 7860
35
 
36
- # 8. 复制并设置启动脚本权限
37
  COPY start.sh /app/start.sh
38
  RUN chmod +x /app/start.sh
39
 
40
- # 启动
41
  CMD ["/app/start.sh"]
 
1
+ # 使用官方 Node.js 22 镜像
2
  FROM node:22-bullseye-slim
3
 
4
  # 设置工作目录
5
  WORKDIR /app
6
 
7
+ # 1. 安装系统工具
8
+ # ⚠️ 新增: socat (用于端口转发核心工具)
9
  RUN apt-get update && apt-get install -y \
10
  git \
11
  curl \
12
  ca-certificates \
13
  procps \
14
+ socat \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # 2. 全局安装 pnpm
18
  RUN npm install -g pnpm
19
 
20
+ # 3. 克隆源码
21
  RUN git clone https://github.com/moltbot/moltbot.git .
22
 
23
+ # 4. 安装依赖
24
  RUN pnpm install
25
 
26
+ # 5. 构建
27
+ RUN pnpm run build || echo "Build skipped..."
28
 
29
+ # 6. 环境变量
30
  ENV GIT_REPO=${GIT_REPO}
31
  ENV GIT_USER=${GIT_USER}
32
  ENV GIT_TOKEN=${GIT_TOKEN}
33
+ # 内部端口改为 3000,外部还是暴露 7860
34
+ ENV PORT=3000
35
 
36
+ # 7. 暴露端口
37
  EXPOSE 7860
38
 
39
+ # 8. 启动脚本
40
  COPY start.sh /app/start.sh
41
  RUN chmod +x /app/start.sh
42
 
 
43
  CMD ["/app/start.sh"]