File size: 1,591 Bytes
bda03b1
775066f
 
 
 
 
bda03b1
775066f
 
 
bda03b1
775066f
 
c3d0544
 
 
bda03b1
 
775066f
 
bda03b1
775066f
 
 
 
 
 
 
 
 
 
bda03b1
 
 
 
775066f
 
 
 
 
 
 
 
 
 
 
 
bda03b1
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
# Use Python 3.11 slim image with CUDA support for better performance
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies required for physics simulation and deep learning
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Copy source directory (original NVIDIA physicsnemo code) - REQUIRED
COPY physics_mcp/source /app/physics_mcp/source

# Copy physics_mcp folder
COPY physics_mcp /app/physics_mcp

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

# 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/physics_mcp/mcp_output/mcp_logs \
    /app/physics_mcp/mcp_output/output \
    && chmod -R 777 /app/physics_mcp/mcp_output/mcp_logs \
    && chmod -R 777 /app/physics_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/physics_mcp/mcp_output/start_mcp.py"]