# ==============================================
# LLMHosts.com -- Development Container
# God-Mode provisioned | Get-er-DONE L3 compatible
# ==============================================
# This container is the SINGLE environment where all AI agent work happens.
# It includes: gh CLI, git, SSH, Python, Node.js, and all build tools.
# Credentials are injected via environment variables (never baked into image).

FROM python:3.12-slim AS base

# ---- System dependencies ----
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    curl \
    ssh \
    jq \
    make \
    build-essential \
    ca-certificates \
    gnupg \
    && rm -rf /var/lib/apt/lists/*

# ---- GitHub CLI ----
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
    | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
    | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
    && apt-get update && apt-get install -y gh \
    && rm -rf /var/lib/apt/lists/*

# ---- Node.js 22 LTS (for frontend dashboard) ----
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/* \
    && npm install -g npm@latest

# ---- SSH configuration directory ----
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh

# ---- Python dev tooling ----
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
    && pip install --no-cache-dir \
    ruff \
    pytest \
    pytest-cov \
    pytest-asyncio \
    httpx \
    mypy \
    pre-commit

# ---- Working directory ----
WORKDIR /workspace

# ---- Entrypoint: auto-authenticates on container start ----
COPY .docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
