Enhance LLM sandbox with persistent caching, helper scripts, and improved UX

Added comprehensive improvements to ClawdBox for better LLM agent experience:

- Tools: Added tree, tmux, htop, strace, file, less for enhanced debugging
- Python packages: httpie, pyyaml, requests, black, ipython pre-installed
- Persistent caching: pip/npm caches now survive container restarts
- Git config persistence: .gitconfig auto-links from /data volume
- Shell improvements: colored prompt, aliases (ll, k, dc), 10k line history
- Helper scripts: ConfigMap with disk-usage, health-check, clean-workspace, install-tools
- Environment variables: TERM, TZ, DEBIAN_FRONTEND for better compatibility
- Makefile: Common operations (build, deploy, logs, shell, health-check)
- Documentation: Comprehensive README with troubleshooting and workflows

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 23:51:26 +11:00
parent 8fe712cda7
commit e039f77f0e
5 changed files with 562 additions and 8 deletions

View File

@@ -29,6 +29,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ripgrep \
ncdu \
sudo \
tree \
tmux \
htop \
strace \
file \
less \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
@@ -44,6 +50,14 @@ RUN OC_VERSION="stable" && \
tar -xvf /tmp/oc.tar.gz -C /usr/bin/ oc && \
rm /tmp/oc.tar.gz && chmod +x /usr/bin/oc
# Install Python tools for LLM work
RUN pip3 install --no-cache-dir --break-system-packages \
httpie \
pyyaml \
requests \
black \
ipython
# Setup SSH directory & Config for OpenShift (Random UID support)
RUN mkdir -p /var/run/sshd && \
chmod 775 /var/run/sshd
@@ -73,9 +87,9 @@ RUN useradd -m -s /bin/bash -u 1000 claw && \
# Prepare volume mount point
# Mount persistent storage here
VOLUME /data
RUN mkdir -p /data && \
chown claw:claw /data && \
chmod 775 /data
RUN mkdir -p /data /data/.cache/pip /data/.cache/npm /data/.local && \
chown -R claw:claw /data && \
chmod -R 775 /data
# Set working directory to the persistent volume
WORKDIR /data
@@ -86,6 +100,20 @@ EXPOSE 2222
# Switch to user 'claw' (UID 1000)
USER claw
# Link package managers to persistent storage
ENV PIP_CACHE_DIR=/data/.cache/pip
ENV npm_config_cache=/data/.cache/npm
ENV XDG_CACHE_HOME=/data/.cache
# Add better default shell experience
RUN echo 'export PS1="\[\e[32m\]\u@clawdbox\[\e[m\]:\[\e[34m\]\w\[\e[m\]\$ "' >> /home/claw/.bashrc && \
echo 'alias ll="ls -lah"' >> /home/claw/.bashrc && \
echo 'alias k="kubectl"' >> /home/claw/.bashrc && \
echo 'alias dc="docker"' >> /home/claw/.bashrc && \
echo 'export HISTFILE=/data/.bash_history' >> /home/claw/.bashrc && \
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", "\
@@ -97,4 +125,5 @@ for keytype in rsa ecdsa ed25519; do \
fi; \
done && \
chmod 600 /data/ssh/ssh_host_*_key && \
if [ -f /data/.gitconfig ]; then ln -sf /data/.gitconfig ~/.gitconfig; fi && \
/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config"]