|
| 1 | +FROM ubuntu:24.04 |
| 2 | + |
| 3 | +ENV DEBIAN_FRONTEND=noninteractive |
| 4 | + |
| 5 | +# Base tools |
| 6 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 7 | + curl \ |
| 8 | + wget \ |
| 9 | + git \ |
| 10 | + ripgrep \ |
| 11 | + build-essential \ |
| 12 | + ca-certificates \ |
| 13 | + gnupg \ |
| 14 | + lsb-release \ |
| 15 | + unzip \ |
| 16 | + sudo \ |
| 17 | + software-properties-common |
| 18 | + |
| 19 | +# GitHub CLI |
| 20 | +RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \ |
| 21 | + gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg && \ |
| 22 | + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | \ |
| 23 | + tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ |
| 24 | + apt-get update && apt-get install -y gh |
| 25 | + |
| 26 | +# Node.js 24 (via Nodesource) |
| 27 | +RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && \ |
| 28 | + apt-get install -y nodejs |
| 29 | + |
| 30 | +# Deno (install globally to /usr/local with pinned version) |
| 31 | +RUN curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh -s v2.5.2 |
| 32 | + |
| 33 | +# Helix editor (requires software-properties-common from base tools) |
| 34 | +RUN add-apt-repository -y ppa:maveonair/helix-editor && \ |
| 35 | + apt-get update && \ |
| 36 | + apt-get install -y helix |
| 37 | + |
| 38 | +# MyST Markdown (via npm to avoid Python PEP 668 issues) |
| 39 | +RUN npm install -g mystmd |
| 40 | + |
| 41 | +# Install Playwright browser and dependencies |
| 42 | +RUN npx playwright install chrome && \ |
| 43 | + npx playwright install-deps chrome |
| 44 | + |
| 45 | +# Create ralph user (with sudo privileges for development) |
| 46 | +RUN useradd -m -s /bin/bash ralph && \ |
| 47 | + echo "ralph ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
| 48 | + |
| 49 | +# Set up working directory with proper ownership |
| 50 | +RUN mkdir -p /app && chown ralph:ralph /app |
| 51 | +WORKDIR /app |
| 52 | + |
| 53 | +# Clone the Common Tools repository into labs subdirectory |
| 54 | +RUN git clone https://github.com/commontoolsinc/labs.git /app/labs && \ |
| 55 | + chown -R ralph:ralph /app/labs |
| 56 | + |
| 57 | +# Copy and append DEPLOY.md to AGENTS.md |
| 58 | +COPY --chown=ralph:ralph DEPLOY.md /tmp/DEPLOY.md |
| 59 | +RUN cat /tmp/DEPLOY.md >> /app/labs/AGENTS.md && \ |
| 60 | + rm /tmp/DEPLOY.md |
| 61 | + |
| 62 | +# Copy the startup script from local directory |
| 63 | +COPY --chown=ralph:ralph start-servers.sh /app/start-servers.sh |
| 64 | +RUN chmod +x /app/start-servers.sh |
| 65 | + |
| 66 | +# Switch to ralph user |
| 67 | +USER ralph |
| 68 | + |
| 69 | +# Configure npm to install global packages in user directory |
| 70 | +RUN npm config set prefix ~/.npm-global |
| 71 | + |
| 72 | +# Add npm-global bin to PATH |
| 73 | +ENV PATH="/home/ralph/.npm-global/bin:$PATH" |
| 74 | + |
| 75 | +# Install Claude CLI and Codex as ralph user (can auto-update) |
| 76 | +RUN npm install -g @anthropic-ai/claude-code && \ |
| 77 | + npm install -g @openai/codex |
| 78 | + |
| 79 | +# Configure Claude MCP server for ralph user |
| 80 | +# --no-sandbox is required because Docker containers restrict namespace creation |
| 81 | +RUN claude mcp add --scope user playwright npx "@playwright/mcp@latest" -- --headless --isolated --no-sandbox |
| 82 | + |
| 83 | +# Start Common Tool servers |
| 84 | +CMD ["/app/start-servers.sh"] |
0 commit comments