# Git Benchmark Container
FROM ubuntu:22.04

# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Install Git and dependencies
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    python3 \
    python3-pip \
    curl \
    time \
    jq \
    bc \
    htop \
    sysstat \
    && rm -rf /var/lib/apt/lists/*

# Install Node.js for coordination scripts
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

# Create workspace
WORKDIR /benchmark

# Copy benchmark scripts
COPY scripts/setup-repos.sh /benchmark/scripts/
COPY scripts/run-benchmarks.sh /benchmark/scripts/
COPY scripts/collect-metrics.sh /benchmark/scripts/
COPY config/git-config.json /benchmark/config/

# Make scripts executable
RUN chmod +x /benchmark/scripts/*.sh

# Configure Git
RUN git config --global user.email "benchmark@agentic-flow.dev" \
    && git config --global user.name "Benchmark Agent" \
    && git config --global init.defaultBranch main

# Set up test repository structure
RUN mkdir -p /repos /results

# Install Python benchmarking tools
RUN pip3 install --no-cache-dir \
    psutil \
    matplotlib \
    numpy \
    pandas

VOLUME ["/repos", "/results"]

CMD ["/benchmark/scripts/run-benchmarks.sh", "git"]
