# ---------------------------------------------------------------------------
# aetos-docs — serves both the HTML documentation portal (nginx) and the
# per-library MCP servers (FastMCP streamable-http).
# ---------------------------------------------------------------------------

FROM python:3.13-slim

LABEL maintainer="Aetoskia <dev@aetoskia.com>"
LABEL description="Unified documentation portal and MCP server for Aetoskia projects"

# --- system deps -----------------------------------------------------------
RUN apt-get update && \
    apt-get install -y --no-install-recommends nginx && \
    rm -rf /var/lib/apt/lists/*

# --- python deps -----------------------------------------------------------
WORKDIR /app

ARG PIP_USERNAME
ARG PIP_PASSWORD
ARG PIP_REPO_URL

COPY requirements.txt .
RUN pip install --no-cache-dir uv && \
    uv pip install --system -r requirements.txt

# --- application files -----------------------------------------------------
COPY main.py core.py config.py collect.py config.yml ./
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -f /etc/nginx/sites-enabled/default

# --- collected documentation tree (flat, one dir per repo) -----------------
COPY _index /usr/share/nginx/html/
COPY openapi-first /usr/share/nginx/html/openapi-first
COPY doc-forge /usr/share/nginx/html/doc-forge
COPY dagpipe /usr/share/nginx/html/dagpipe
COPY mail-intake /usr/share/nginx/html/mail-intake
COPY omniread /usr/share/nginx/html/omniread
COPY py-jwt /usr/share/nginx/html/py-jwt
COPY hexa /usr/share/nginx/html/hexa
COPY mongo-ops /usr/share/nginx/html/mongo-ops
COPY auth-server /usr/share/nginx/html/auth-server
COPY blog /usr/share/nginx/html/blog
COPY media-manager /usr/share/nginx/html/media-manager

# --- MCP bundles -----------------------------------------------------------
COPY mcp /app/mcp

EXPOSE 8000 8001 8002 8003 8004 8005 8006 8007 9000

CMD ["python", "main.py"]