tools, binaries, and library management
This commit is contained in:
45
Dockerfile
45
Dockerfile
@ -1,21 +1,56 @@
|
||||
FROM node:22-slim
|
||||
|
||||
# Install runtime dependencies
|
||||
# System dependencies:
|
||||
# - curl/ca-certificates: downloads (Claude Code installer, nvm, git-spice)
|
||||
# - git + ripgrep: Claude Code requirements
|
||||
# - build-essential, libssl-dev, libreadline-dev, zlib1g-dev: rbenv/ruby-build deps
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
git \
|
||||
ripgrep \
|
||||
bash \
|
||||
build-essential \
|
||||
libssl-dev \
|
||||
libreadline-dev \
|
||||
zlib1g-dev \
|
||||
libffi-dev \
|
||||
libyaml-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create a non-root user with a real home directory
|
||||
# --- rbenv (installed into home volume on first run, via entrypoint) ---
|
||||
# RBENV_ROOT points into the home volume so the install persists across rebuilds.
|
||||
ENV RBENV_ROOT=/home/coder/.rbenv
|
||||
ENV PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"
|
||||
|
||||
# Initialise rbenv shims for all bash sessions (no-op if not yet installed)
|
||||
RUN echo '[ -d "$RBENV_ROOT/bin" ] && eval "$(rbenv init - bash)"' >> /etc/bash.bashrc
|
||||
|
||||
# --- nvm (installed into home volume on first run, via entrypoint) ---
|
||||
# NVM_DIR points into the home volume so the install persists across rebuilds.
|
||||
ENV NVM_DIR=/home/coder/.nvm
|
||||
|
||||
# Source nvm for all bash sessions (nvm.sh is a no-op if not yet installed)
|
||||
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> /etc/bash.bashrc
|
||||
|
||||
# --- git-spice ---
|
||||
# Releases are named git-spice.Linux-<arch>.tar.gz; uname -m gives the right arch directly.
|
||||
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
|
||||
|
||||
# --- non-root user ---
|
||||
RUN useradd -m -s /bin/bash -u 1001 coder
|
||||
|
||||
# Ensure ~/.local/bin is on PATH (where the native installer puts the binary)
|
||||
ENV PATH="/home/coder/.local/bin:/home/coder/.claude/bin:${PATH}"
|
||||
# Claude Code native installer lands in ~/.local/bin or ~/.claude/bin
|
||||
ENV PATH="/home/coder/.local/bin:/home/coder/.claude/bin:$PATH"
|
||||
|
||||
# Copy entrypoint (as root, then lock down)
|
||||
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
|
||||
USER coder
|
||||
|
||||
Reference in New Issue
Block a user