Start OpenClaw node host on ClawdBox boot

This commit is contained in:
Clawdbot
2026-06-07 14:30:07 +10:00
parent 18f559c4e6
commit 48e30b9d0e
8 changed files with 244 additions and 15 deletions

View File

@@ -35,7 +35,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
strace \
file \
less \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
@@ -99,6 +99,16 @@ RUN mkdir -p /data /data/.cache/pip /data/.cache/npm /data/.local && \
# Set working directory to the persistent volume
WORKDIR /data
# Install startup and OpenClaw node helper scripts
COPY scripts/clawdbox-entrypoint /usr/local/bin/clawdbox-entrypoint
COPY scripts/start-clawdbox-node /usr/local/bin/start-clawdbox-node
COPY scripts/status-clawdbox-node /usr/local/bin/status-clawdbox-node
COPY scripts/stop-clawdbox-node /usr/local/bin/stop-clawdbox-node
RUN chmod +x /usr/local/bin/clawdbox-entrypoint \
/usr/local/bin/start-clawdbox-node \
/usr/local/bin/status-clawdbox-node \
/usr/local/bin/stop-clawdbox-node
# Expose SSH port (non-privileged)
EXPOSE 2222
@@ -119,16 +129,5 @@ RUN echo 'export PS1="\[\e[32m\]\u@clawdbox\[\e[m\]:\[\e[34m\]\w\[\e[m\]\$ "' >>
echo 'export HISTSIZE=10000' >> /home/claw/.bashrc && \
echo 'export HISTFILESIZE=10000' >> /home/claw/.bashrc
# Start SSH daemon
# The keys are generated if they don't exist on the persistent volume
CMD ["/bin/bash", "-c", "\
mkdir -p /data/ssh && \
for keytype in rsa ecdsa ed25519; do \
if [ ! -f /data/ssh/ssh_host_${keytype}_key ]; then \
echo \"Generating persistent host ${keytype} key...\"; \
ssh-keygen -q -f /data/ssh/ssh_host_${keytype}_key -N '' -t ${keytype}; \
fi; \
done && \
chmod 600 /data/ssh/ssh_host_*_key && \
ln -sf /data/.gitconfig ~/.gitconfig && \
/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config"]
# Start SSH in the foreground and opportunistically start the OpenClaw node host.
CMD ["/usr/local/bin/clawdbox-entrypoint"]