File size: 1,814 Bytes
9c1f6b8
 
 
 
 
 
 
 
 
 
b6b0831
 
 
9c1f6b8
 
dd68b3d
9c1f6b8
 
 
 
 
69a5433
 
 
 
 
 
9c1f6b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.11 slim image as base
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    libcairo2-dev \
    pkg-config \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy socialsim_mcp folder structure (includes december-measurements module)
COPY socialsim_mcp /app/socialsim_mcp

# Copy MCP service requirements
COPY socialsim_mcp/mcp_output/requirements.txt /app/requirements.txt

# Create placeholder for infodynamics.jar if it doesn't exist
# (The actual JAR file is in .gitignore and not tracked in git)
RUN if [ ! -f /app/socialsim_mcp/mcp_output/december-measurements/infodynamics.jar ]; then \
        touch /app/socialsim_mcp/mcp_output/december-measurements/infodynamics.jar; \
    fi

# Install Python dependencies with explicit version check
RUN pip install --no-cache-dir -r /app/requirements.txt && \
    pip list | grep fastmcp && \
    python -c "import fastmcp; print(f'FastMCP version installed: {fastmcp.__version__}')"

# Note: FastAPI and Uvicorn are already included as dependencies of fastmcp
# DO NOT reinstall them separately as it may upgrade fastmcp to a newer version

# Create output directories with write permissions
RUN mkdir -p /app/socialsim_mcp/mcp_output/mcp_logs \
    /app/socialsim_mcp/mcp_output/output \
    && chmod -R 777 /app/socialsim_mcp/mcp_output/mcp_logs \
    && chmod -R 777 /app/socialsim_mcp/mcp_output/output

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV MCP_TRANSPORT=http
# Hugging Face Space uses PORT env var, default to 7860
ENV PORT=7860
ENV MCP_PORT=7860

# Expose port (Hugging Face uses 7860 by default)
EXPOSE 7860

# Start MCP service in HTTP mode
CMD ["python", "/app/socialsim_mcp/mcp_output/start_mcp.py"]