Spaces:
Running
Running
| # 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 and source code | |
| COPY pyproject.toml pdm.lock* ./ | |
| COPY src/ ./src/ | |
| COPY README.md LICENSE ./ | |
| # Install dependencies and project | |
| 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 HF_EDA_HOST="0.0.0.0" | |
| ENV HF_EDA_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", "--port", "7860", "--host", "0.0.0.0"] | |