|
|
|
|
|
FROM node:22-bookworm AS moltbot-build |
|
|
|
|
|
|
|
|
RUN apt-get update \ |
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
|
git \ |
|
|
ca-certificates \ |
|
|
curl \ |
|
|
python3 \ |
|
|
make \ |
|
|
g++ \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN curl -fsSL https://bun.sh/install | bash |
|
|
ENV PATH="/root/.bun/bin:${PATH}" |
|
|
|
|
|
RUN corepack enable |
|
|
|
|
|
WORKDIR /moltbot |
|
|
|
|
|
|
|
|
ARG MOLTBOT_GIT_REF=main |
|
|
RUN git clone --depth 1 --branch "${MOLTBOT_GIT_REF}" https://github.com/moltbot/moltbot.git . |
|
|
|
|
|
|
|
|
|
|
|
RUN set -eux; \ |
|
|
find ./extensions -name 'package.json' -type f | while read -r f; do \ |
|
|
sed -i -E 's/"moltbot"[[:space:]]*:[[:space:]]*">=[^"]+"/"moltbot": "*"/g' "$f"; \ |
|
|
sed -i -E 's/"moltbot"[[:space:]]*:[[:space:]]*"workspace:[^"]+"/"moltbot": "*"/g' "$f"; \ |
|
|
done |
|
|
|
|
|
RUN pnpm install --no-frozen-lockfile |
|
|
RUN pnpm build |
|
|
ENV MOLTBOT_PREFER_PNPM=1 |
|
|
RUN pnpm ui:install && pnpm ui:build |
|
|
|
|
|
|
|
|
|
|
|
FROM node:22-bookworm |
|
|
ENV NODE_ENV=production |
|
|
|
|
|
RUN apt-get update \ |
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
|
ca-certificates \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY package.json ./ |
|
|
RUN npm install --omit=dev && npm cache clean --force |
|
|
|
|
|
|
|
|
COPY --from=moltbot-build /moltbot /moltbot |
|
|
|
|
|
|
|
|
RUN printf '%s\n' '#!/usr/bin/env bash' 'exec node /moltbot/dist/entry.js "$@"' > /usr/local/bin/moltbot \ |
|
|
&& chmod +x /usr/local/bin/moltbot |
|
|
|
|
|
COPY src ./src |
|
|
|
|
|
|
|
|
ENV MOLTBOT_PUBLIC_PORT=7860 |
|
|
ENV PORT=7860 |
|
|
EXPOSE 7860 |
|
|
CMD ["node", "src/server.js"] |
|
|
|