# safeclaude-base — the shared base every project builds on. Keep this generic: # project-specific packages and language versions go in each project's own # .safeclaude/Dockerfile (which starts with `FROM safeclaude-base`), not here. # # This image runs as root so project Dockerfiles can install system packages # freely. Don't worry — the launcher locks things down at run time (normal user, # no special privileges), so nothing Claude does actually runs as root. # # Debian (slim) as the base: small, stable, and its apt packages behave # predictably in a container — notably `chromium` is a real package here, unlike # on Ubuntu where it's a snap stub that won't run in a container. FROM debian:bookworm-slim # Just the basics every project needs: # - curl/ca-certificates: for downloads (the Claude installer, git-spice) # - git + ripgrep: required by Claude Code # We leave apt's package lists in place (no cleanup) so a project Dockerfile can # install packages without re-fetching them — though it should still run its own # `apt-get update` first, since this base image may be days or weeks old. RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ git \ ripgrep \ bash # --- git-spice (a tool for stacked pull requests, handy in the Claude workflow) --- # Releases are named git-spice.Linux-.tar.gz, and `uname -m` gives the arch. RUN ARCH=$(uname -m) && \ GS_VERSION=$(curl -fsSL https://api.github.com/repos/abhinav/git-spice/releases/latest \ | grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/') && \ mkdir -p /tmp/gs-install && \ curl -fsSL "https://github.com/abhinav/git-spice/releases/download/v${GS_VERSION}/git-spice.Linux-${ARCH}.tar.gz" \ | tar -xz -C /tmp/gs-install && \ find /tmp/gs-install -maxdepth 1 -type f -executable -exec cp {} /usr/local/bin/gs \; && \ chmod +x /usr/local/bin/gs && \ rm -rf /tmp/gs-install # --- the user Claude runs as --- # We create this user so the home folder is owned by the same ID the launcher # runs as. Without it, the container couldn't write to its own home. RUN useradd -m -s /bin/bash -u 1001 coder # Claude installs itself into one of these folders, so add them to PATH. ENV PATH="/home/coder/.local/bin:/home/coder/.claude/bin:$PATH" COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh WORKDIR /code ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["bash"]