File size: 1,579 Bytes
84a8f07
 
1742f51
84a8f07
 
 
 
 
 
 
 
 
1742f51
 
 
 
 
84a8f07
c2d9a42
 
 
 
84a8f07
 
 
 
1742f51
84a8f07
 
 
 
 
 
 
 
 
 
1742f51
84a8f07
 
 
 
 
 
 
 
 
 
1742f51
 
84a8f07
c2d9a42
1742f51
c2d9a42
84a8f07
1742f51
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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"]