# 使用官方 Node.js 22 镜像 FROM node:22-bullseye-slim # 设置工作目录 WORKDIR /app # 1. 安装系统工具 # ⚠️ 新增: socat (用于端口转发核心工具) RUN apt-get update && apt-get install -y \ git \ curl \ ca-certificates \ procps \ socat \ && rm -rf /var/lib/apt/lists/* # 2. 全局安装 pnpm RUN npm install -g pnpm # 3. 克隆源码 RUN git clone https://github.com/moltbot/moltbot.git . # 4. 安装依赖 RUN pnpm install # 5. 构建 RUN pnpm run build || echo "Build skipped..." # 6. 环境变量 ENV GIT_REPO=${GIT_REPO} ENV GIT_USER=${GIT_USER} ENV GIT_TOKEN=${GIT_TOKEN} # 内部端口改为 3000,外部还是暴露 7860 ENV PORT=3000 # 7. 暴露端口 EXPOSE 7860 # 8. 启动脚本 COPY start.sh /app/start.sh RUN chmod +x /app/start.sh CMD ["/app/start.sh"]