lolout1 commited on
Commit
c33c883
·
1 Parent(s): e5fdbf1

testing Dockerfile changes

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -25
Dockerfile CHANGED
@@ -14,39 +14,40 @@ RUN apt-get update && apt-get install -y \
14
  libgl1-mesa-glx \
15
  wget \
16
  curl \
 
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Create user (required by Hugging Face)
20
  RUN useradd -m -u 1000 user
21
 
22
- # Set working directory
23
  WORKDIR /app
24
 
25
- # Install Python dependencies in the correct order
26
- # First, upgrade pip and install essential tools
27
  RUN pip install --upgrade pip setuptools wheel
28
 
29
- # Install PyTorch dependencies FIRST
30
  RUN pip install sympy filelock jinja2 networkx requests typing-extensions
31
-
32
- # Install PyTorch CPU version WITH dependencies
33
  RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu
34
 
35
- # Install numpy and pillow (specific versions for compatibility)
36
- RUN pip install numpy==1.24.3 pillow==10.0.0
 
 
 
 
37
 
38
- # Install detectron2 from pre-built wheel (much more reliable than building from source)
39
- RUN pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch2.0/index.html
 
 
 
40
 
41
- # Install other core dependencies
42
  RUN pip install \
43
- opencv-python \
44
- scipy \
45
- scikit-learn \
46
- scikit-image \
47
- matplotlib \
48
  gradio \
49
  huggingface_hub \
 
 
50
  tqdm
51
 
52
  # Switch to user
@@ -54,18 +55,16 @@ USER user
54
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
55
 
56
  # Copy application files
57
- COPY --chown=user:user requirements.txt /app/requirements.txt
58
- RUN pip install --user -r /app/requirements.txt
59
-
60
  COPY --chown=user:user . /app
61
 
62
- # Set environment for CPU
 
 
 
 
63
  ENV CUDA_VISIBLE_DEVICES=""
64
  ENV FORCE_CUDA="0"
65
  ENV TORCH_CUDA_ARCH_LIST=""
66
 
67
- # Expose port
68
  EXPOSE 7860
69
-
70
- # Run the application
71
- CMD ["python", "gradio_test.py"]
 
14
  libgl1-mesa-glx \
15
  wget \
16
  curl \
17
+ ninja-build \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Create user
21
  RUN useradd -m -u 1000 user
22
 
 
23
  WORKDIR /app
24
 
25
+ # Upgrade pip
 
26
  RUN pip install --upgrade pip setuptools wheel
27
 
28
+ # Install PyTorch and dependencies in the correct order
29
  RUN pip install sympy filelock jinja2 networkx requests typing-extensions
 
 
30
  RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu
31
 
32
+ # Force specific numpy/pillow versions AFTER torch installation
33
+ RUN pip uninstall -y numpy pillow && \
34
+ pip install numpy==1.24.3 pillow==10.0.0
35
+
36
+ # Install COCO API and other dependencies needed by detectron2
37
+ RUN pip install pycocotools opencv-python scipy matplotlib
38
 
39
+ # Clone and install detectron2 from source
40
+ RUN git clone https://github.com/facebookresearch/detectron2.git /tmp/detectron2 && \
41
+ cd /tmp/detectron2 && \
42
+ git checkout v0.6 && \
43
+ pip install -e .
44
 
45
+ # Install additional dependencies
46
  RUN pip install \
 
 
 
 
 
47
  gradio \
48
  huggingface_hub \
49
+ scikit-learn \
50
+ scikit-image \
51
  tqdm
52
 
53
  # Switch to user
 
55
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
56
 
57
  # Copy application files
 
 
 
58
  COPY --chown=user:user . /app
59
 
60
+ # Install remaining requirements as user
61
+ COPY --chown=user:user requirements.txt /app/
62
+ RUN pip install --user --no-deps -r requirements.txt || true
63
+
64
+ # Environment variables
65
  ENV CUDA_VISIBLE_DEVICES=""
66
  ENV FORCE_CUDA="0"
67
  ENV TORCH_CUDA_ARCH_LIST=""
68
 
 
69
  EXPOSE 7860
70
+ CMD ["python", "app.py"]