Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +8 -1
Dockerfile
CHANGED
@@ -2,18 +2,25 @@ FROM python:3.10-slim
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
libgl1 \
|
7 |
libglib2.0-0 \
|
8 |
&& rm -rf /var/lib/apt/lists/*
|
9 |
|
|
|
10 |
COPY requirements.txt ./
|
11 |
|
12 |
-
#
|
|
|
|
|
|
|
13 |
RUN pip install --no-cache-dir torch==2.0.1+cpu torchvision==0.15.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
14 |
|
|
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
|
|
17 |
COPY app.py .
|
18 |
|
19 |
EXPOSE 5000
|
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Install system packages
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
libgl1 \
|
8 |
libglib2.0-0 \
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
+
# Copy requirements early
|
12 |
COPY requirements.txt ./
|
13 |
|
14 |
+
# Step 1: install numpy first to avoid torch import error
|
15 |
+
RUN pip install --no-cache-dir numpy
|
16 |
+
|
17 |
+
# Step 2: install torch and torchvision (CPU versions)
|
18 |
RUN pip install --no-cache-dir torch==2.0.1+cpu torchvision==0.15.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
19 |
|
20 |
+
# Step 3: install everything else
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy application code
|
24 |
COPY app.py .
|
25 |
|
26 |
EXPOSE 5000
|