FROM python:3.10-alpine

# Install system dependencies
RUN apk add --no-cache build-base libffi-dev openssl-dev

WORKDIR /app

# Copy dependency files first for better layer caching
COPY pyproject.toml README.md ./
COPY ai4scholar_mcp/ ai4scholar_mcp/

# Upgrade pip and install dependencies
RUN pip install --upgrade pip \
    && pip install --no-cache-dir .

# SSE server port
EXPOSE 8000

# Run MCP server in SSE mode
CMD ["python", "-m", "ai4scholar_mcp.server", "--transport", "sse", "--host", "0.0.0.0", "--port", "8000"]
