Spaces:
Sleeping
Sleeping
| # MaTableGPT MCP Service Docker Image | |
| # ==================================== | |
| # For HuggingFace Spaces Deployment (SSE Mode) | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # MCP SSE Server Configuration | |
| # HuggingFace Spaces 使用端口 7860 | |
| ENV MCP_HOST=0.0.0.0 | |
| ENV MCP_PORT=7860 | |
| # Disable MCP transport security for reverse proxy (HuggingFace Space) | |
| ENV MCP_TRANSPORT_SECURITY_ENABLED=false | |
| ENV FASTMCP_ALLOWED_HOSTS=* | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Download NLTK data for table splitting | |
| RUN python -c "import nltk; nltk.download('punkt')" || true | |
| # Copy application code | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p /app/sessions /app/temp | |
| # Set permissions for HuggingFace Spaces | |
| RUN chmod -R 777 /app/sessions /app/temp | |
| # Expose MCP SSE port (HuggingFace Spaces uses 7860) | |
| EXPOSE 7860 | |
| # Health check endpoint | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Run MCP service in SSE mode | |
| CMD ["python", "start_mcp.py", "--mode", "sse", "--host", "0.0.0.0", "--port", "7860"] | |