SEUyishu commited on
Commit
b2070f4
·
verified ·
1 Parent(s): bec0b04

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -40
Dockerfile CHANGED
@@ -1,40 +1,37 @@
1
- FROM python:3.10-slim
2
-
3
- # Create non-root user for HuggingFace Space
4
- RUN useradd -m -u 1000 user && \
5
- apt-get update && \
6
- apt-get install -y --no-install-recommends \
7
- build-essential \
8
- git \
9
- && rm -rf /var/lib/apt/lists/* && \
10
- python -m pip install --upgrade pip
11
-
12
- USER user
13
- ENV PATH="/home/user/.local/bin:$PATH"
14
- ENV HOME="/home/user"
15
-
16
- WORKDIR /app
17
-
18
- # Copy requirements first for better caching
19
- COPY --chown=user ./mcp_output/requirements.txt /app/requirements.txt
20
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
-
22
- # Copy the entire MatDeepLearn project
23
- COPY --chown=user . /app
24
-
25
- # Set Python path to include MatDeepLearn
26
- ENV PYTHONPATH=/app:$PYTHONPATH
27
-
28
- # Expose HuggingFace default port
29
- EXPOSE 7860
30
-
31
- # Set environment variables for MCP service
32
- ENV MCP_TRANSPORT=http
33
- ENV MCP_PORT=7860
34
-
35
- # Health check
36
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
37
- CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
38
-
39
- # Start MCP service
40
- CMD ["python", "mcp_output/start_mcp.py"]
 
1
+ FROM python:3.10-slim
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ git \
8
+ && rm -rf /var/lib/apt/lists/* && \
9
+ python -m pip install --upgrade pip
10
+
11
+ WORKDIR /app
12
+
13
+ # Install PyTorch first (CPU version)
14
+ RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
15
+
16
+ # Install PyTorch Geometric dependencies with pre-built wheels
17
+ RUN pip install --no-cache-dir torch-scatter torch-sparse torch-cluster torch-spline-conv -f https://data.pyg.org/whl/torch-2.5.0+cpu.html
18
+
19
+ # Copy and install remaining requirements
20
+ COPY ./mcp_output/requirements.txt /app/requirements.txt
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy the entire MatDeepLearn project
24
+ COPY . /app
25
+
26
+ # Set Python path to include MatDeepLearn
27
+ ENV PYTHONPATH=/app:$PYTHONPATH
28
+
29
+ # Expose HuggingFace default port
30
+ EXPOSE 7860
31
+
32
+ # Set environment variables for MCP service
33
+ ENV MCP_TRANSPORT=http
34
+ ENV MCP_PORT=7860
35
+
36
+ # Start MCP service
37
+ CMD ["python", "mcp_output/start_mcp.py"]