# Multi-stage build for hf-eda-mcp server FROM python:3.13-slim as builder # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Install PDM RUN pip install --no-cache-dir pdm # Copy dependency files COPY pyproject.toml pdm.lock* ./ # Install dependencies RUN pdm install --prod --no-lock --no-editable # Production stage FROM python:3.13-slim # Set working directory WORKDIR /app # Install runtime dependencies RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Copy installed dependencies from builder COPY --from=builder /app/.venv /app/.venv # Copy application code COPY src/ ./src/ COPY README.md LICENSE ./ # Set environment variables ENV PATH="/app/.venv/bin:$PATH" ENV PYTHONUNBUFFERED=1 ENV GRADIO_SERVER_NAME="0.0.0.0" ENV GRADIO_SERVER_PORT=7860 # Expose Gradio port EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:7860/health', timeout=5)" # Run the MCP server CMD ["python", "-m", "hf_eda_mcp"]