# Hosted FILTRIX MCP server (Streamable HTTP at /mcp, behind the frontend nginx).
FROM python:3.11-slim-trixie

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

WORKDIR /srv

COPY requirements.lock ./
RUN pip install --no-cache-dir --root-user-action=ignore --require-hashes -r requirements.lock

COPY pyproject.toml README.md LICENSE ./
COPY src ./src
RUN pip install --no-cache-dir --root-user-action=ignore --no-deps .

USER nobody
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
  CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=4).status == 200 else 1)"
CMD ["filtrix-mcp", "--transport", "http", "--host", "0.0.0.0", "--port", "8080"]
