FROM python:3.12-slim

WORKDIR /app

# Install uv for fast dependency management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Copy project files
COPY pyproject.toml uv.lock README.md LICENSE ./
COPY src/ ./src/

# Install dependencies and the package
# Use --no-cache to avoid filling up disk space with cache
RUN uv pip install --system --no-cache . && \
    rm -rf /tmp/* /root/.cache

# Expose port for SSE server
EXPOSE 8000

# Default environment variables (can be overridden)
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8000
ENV MCP_DISABLE_EXECUTION_TOOLS=false
ENV MCP_USE_LOCAL_DOCS=false

# Run SSE server with configurable options
CMD sh -c "data-intg-mcp --transport sse --host ${MCP_HOST} --port ${MCP_PORT} $([ \"${MCP_DISABLE_EXECUTION_TOOLS}\" = \"true\" ] && echo '--disable-execution-tools' || echo '') $([ \"${MCP_USE_LOCAL_DOCS}\" = \"true\" ] && echo '--use-local-docs' || echo '')"
