# Lumina Sandbox Image
# Contains AI coding assistants: Claude Code, OpenAI Codex, GitHub Copilot CLI
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# Install base packages (without nodejs)
RUN apt-get update && apt-get install -y \
    curl \
    git \
    vim \
    tmux \
    wget \
    ca-certificates \
    gnupg \
    build-essential \
    cmake \
    python3 \
    python3-pip \
    sudo \
    unzip \
    supervisor \
    ffmpeg \
    imagemagick \
    && rm -rf /var/lib/apt/lists/*

# Symlink python/pip to python3/pip3
RUN ln -sf /usr/bin/python3 /usr/local/bin/python \
    && ln -sf /usr/bin/pip3 /usr/local/bin/pip

# Install yq (YAML processor) - not available in Ubuntu repos
RUN curl -fsSL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$(dpkg --print-architecture) -o /usr/local/bin/yq \
    && chmod +x /usr/local/bin/yq

# Install Node.js 20.x from nodesource (separate step to avoid ubuntu's old nodejs)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/* \
    && node --version && npm --version

# Install Claude Code CLI (native binary)
RUN curl -fsSL https://claude.ai/install.sh | bash -s latest \
    && ln -sf /root/.claude/bin/claude /usr/local/bin/claude || true

# Install OpenAI Codex CLI
RUN npm install -g @openai/codex

# Install GitHub Copilot CLI
RUN npm install -g @github/copilot

# Install copilot-api (OpenAI-compatible API server)
RUN npm install -g copilot-api || true

# Enable tmux mouse mode system-wide (scroll, click, resize)
RUN echo 'set -g mouse on' > /etc/tmux.conf

# Create workspaces directory
RUN mkdir -p /workspaces && chmod 777 /workspaces

WORKDIR /workspaces

CMD ["sleep", "infinity"]
