spawn/sh/fly/docker/openclaw.Dockerfile
A 7419ff8290
fix: use npm install for OpenClaw to fix Node module resolution (#1878)
OpenClaw runs under Node, but bun's flat node_modules layout breaks
Node's require() resolver when dynamically loading channel plugins.
Switching to npm install ensures standard node_modules layout.

Fixes #1875

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-24 04:51:09 -05:00

32 lines
1.1 KiB
Docker

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# Base packages (matches waitForCloudInit in fly.ts)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl git ca-certificates build-essential unzip xz-utils zsh && \
rm -rf /var/lib/apt/lists/*
# Node.js 22 via apt + n (matches fly.ts cloud-init strategy)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends nodejs npm && \
npm install -g n && n 22 && \
ln -sf /usr/local/bin/node /usr/bin/node && \
ln -sf /usr/local/bin/npm /usr/bin/npm && \
ln -sf /usr/local/bin/npx /usr/bin/npx && \
rm -rf /var/lib/apt/lists/*
# Bun
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:/root/.local/bin:${PATH}"
# OpenClaw via npm (Node runtime needs standard node_modules layout)
RUN npm install -g openclaw
# Ensure tools are on PATH for all shells
RUN for rc in /root/.bashrc /root/.zshrc; do \
grep -q '.bun/bin' "$rc" 2>/dev/null || \
echo 'export PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH"' >> "$rc"; \
done
CMD ["/bin/sleep", "inf"]