This repository has been archived on 2026-02-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
clawdbot_build/Dockerfile
Aydent e4d4df16ad
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 8s
Fix: Switch to Local Build strategy (bypass registry upload)
2026-02-01 21:55:52 +01:00

66 lines
1.4 KiB
Docker

# Stage 1: Builder
FROM node:22-bookworm AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
python3 \
make \
g++ \
socat \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
RUN curl -fsSL https://bun.sh/install | bash
ENV BUN_INSTALL="/root/.bun"
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN corepack enable
WORKDIR /app
# Clone with depth 1 to save space (removes history)
RUN git clone --depth 1 https://github.com/moltbot/moltbot.git .
# Install dependencies
RUN pnpm install --frozen-lockfile
# Build Backend
RUN CLAWDBOT_A2UI_SKIP_MISSING=1 pnpm build
# Build UI
ENV CLAWDBOT_PREFER_PNPM=1
RUN pnpm ui:install
RUN pnpm ui:build
# Remove devDependencies to reduce size
RUN CI=true pnpm prune --prod --ignore-scripts
# Remove .git folder to save space
RUN rm -rf .git
# Stage 2: Runner
FROM node:22-bookworm-slim
WORKDIR /home/node/app
# Install runtime dependencies (lightweight)
# build tools (make, g++) are not needed for runtime
RUN apt-get update && apt-get install -y \
python3 \
socat \
git \
&& rm -rf /var/lib/apt/lists/*
# Set user
USER node
# Copy application from builder
# We copy the entire folder as pruned by 'pnpm prune --prod'
COPY --from=builder --chown=node:node /app /home/node/app
# Start
CMD ["node", "dist/index.js"]