Koko / Dockerfile
zhengr's picture
Update Dockerfile
323a7fe verified
FROM node:22-bookworm
# Install Bun (required for build scripts)
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
# 启用 pnpm
RUN corepack enable
WORKDIR /app
ARG CLAWDBOT_DOCKER_APT_PACKAGES=""
RUN if [ -n "$CLAWDBOT_DOCKER_APT_PACKAGES" ]; then \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $CLAWDBOT_DOCKER_APT_PACKAGES && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
fi
# 安装 git(用于克隆仓库)
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN npm i -g clawdbot
# 克隆源码
RUN git clone https://github.com/moltbot/moltbot.git ./
# 安装依赖并构建
RUN pnpm install --frozen-lockfile
RUN pnpm build
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
ENV CLAWDBOT_PREFER_PNPM=1
RUN pnpm ui:install
RUN pnpm ui:build
# 设置生产环境
ENV NODE_ENV=production
ENV GATEWAY__CONTROLUI__ALLOWINSECUREAUTH=true
# 暴露默认端口(根据项目文档为 8888)
EXPOSE 18789
#CMD ["node","dist/index.js"]
CMD ["node","dist/index.js","gateway","--bind","lan","--port","18789","--allow-unconfigured","--auth","token","--token","3f9dce3b44fbb40e1bba6dd0d5d302361a01e63bc0d40982","--password","admin123"]