PUSHPENDAR commited on
Commit
469e358
·
verified ·
1 Parent(s): be46efc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -9
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
@@ -9,14 +9,12 @@ RUN apt-get update && apt-get install -y \
9
  libgl1-mesa-glx libgomp1 \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # STEP 1: torch first (detectron2 needs it at build time)
13
- RUN pip install --no-cache-dir torch==2.1.0 torchvision==0.16.0
14
-
15
- # STEP 2: detectron2 (torch is now available)
16
  RUN pip install --no-cache-dir \
17
- 'detectron2 @ git+https://github.com/facebookresearch/detectron2.git'
18
 
19
- # STEP 3: everything else
20
  RUN pip install --no-cache-dir \
21
  gradio==4.44.0 \
22
  opencv-python-headless \
@@ -26,10 +24,8 @@ RUN pip install --no-cache-dir \
26
 
27
  COPY app.py .
28
 
29
- # Create non-root user (required by HF Spaces)
30
  RUN useradd -m -u 1000 user
31
  USER user
32
 
33
  EXPOSE 7860
34
-
35
  CMD ["python", "app.py"]
 
1
+ FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
2
 
3
  WORKDIR /app
4
 
 
9
  libgl1-mesa-glx libgomp1 \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Install detectron2 prebuilt wheel (matches torch 2.1.0 + cuda 11.8)
13
+ # This avoids compiling from source entirely
 
 
14
  RUN pip install --no-cache-dir \
15
+ detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu118/torch2.1/index.html
16
 
17
+ # Other deps
18
  RUN pip install --no-cache-dir \
19
  gradio==4.44.0 \
20
  opencv-python-headless \
 
24
 
25
  COPY app.py .
26
 
 
27
  RUN useradd -m -u 1000 user
28
  USER user
29
 
30
  EXPOSE 7860
 
31
  CMD ["python", "app.py"]