lolout1 commited on
Commit
bfbccfe
·
1 Parent(s): 8332d88

docker file updates

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -20
Dockerfile CHANGED
@@ -17,55 +17,64 @@ RUN apt-get update && apt-get install -y \
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
- # CRITICAL: Downgrade setuptools to avoid the deprecated warnings
26
  RUN pip install --upgrade pip
27
  RUN pip install setuptools==69.5.1 wheel
28
 
29
- # Install PyTorch and core dependencies
30
  RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu
 
 
31
  RUN pip install numpy==1.24.3 pillow==10.0.0
32
 
33
- # Install COCO API first (required by detectron2)
34
  RUN pip install pycocotools opencv-python
35
 
36
- # Method 1: Install detectron2 without editable mode and without build isolation
37
  RUN git clone https://github.com/facebookresearch/detectron2.git /tmp/detectron2 && \
38
  cd /tmp/detectron2 && \
39
  git checkout v0.6 && \
40
  pip install --no-build-isolation --no-deps . && \
41
- pip install -r requirements.txt
 
42
 
43
- # Alternative Method 2: Build wheel first
44
- # RUN git clone https://github.com/facebookresearch/detectron2.git /tmp/detectron2 && \
45
- # cd /tmp/detectron2 && \
46
- # git checkout v0.6 && \
47
- # python setup.py bdist_wheel && \
48
- # pip install dist/*.whl && \
49
- # pip install -r requirements.txt
 
 
 
 
 
 
 
 
 
50
 
51
- # Install other dependencies
52
  RUN pip install \
53
  gradio \
54
  huggingface_hub \
55
- scipy \
56
  scikit-learn \
57
- scikit-image \
58
- matplotlib \
59
- tqdm
60
 
61
  # Switch to user
62
  USER user
63
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
64
 
65
- # Copy application
66
  COPY --chown=user:user . /app
67
 
68
- # Install remaining requirements as user
69
  COPY --chown=user:user requirements.txt /app/
70
  RUN pip install --user --no-deps -r requirements.txt || true
71
 
 
17
  ninja-build \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Create user for Hugging Face
21
  RUN useradd -m -u 1000 user
22
 
23
  WORKDIR /app
24
 
25
+ # Upgrade pip and install setuptools
26
  RUN pip install --upgrade pip
27
  RUN pip install setuptools==69.5.1 wheel
28
 
29
+ # Install PyTorch and dependencies
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
33
  RUN pip install numpy==1.24.3 pillow==10.0.0
34
 
35
+ # Install COCO API and OpenCV
36
  RUN pip install pycocotools opencv-python
37
 
38
+ # Install detectron2 - FIXED VERSION
39
  RUN git clone https://github.com/facebookresearch/detectron2.git /tmp/detectron2 && \
40
  cd /tmp/detectron2 && \
41
  git checkout v0.6 && \
42
  pip install --no-build-isolation --no-deps . && \
43
+ cd / && \
44
+ rm -rf /tmp/detectron2
45
 
46
+ # Install detectron2 dependencies manually (since v0.6 has no requirements.txt)
47
+ RUN pip install \
48
+ fvcore \
49
+ iopath \
50
+ omegaconf \
51
+ hydra-core \
52
+ black \
53
+ pyyaml \
54
+ matplotlib \
55
+ tqdm \
56
+ termcolor \
57
+ yacs \
58
+ tabulate \
59
+ cloudpickle \
60
+ Pillow \
61
+ scipy
62
 
63
+ # Install additional dependencies
64
  RUN pip install \
65
  gradio \
66
  huggingface_hub \
 
67
  scikit-learn \
68
+ scikit-image
 
 
69
 
70
  # Switch to user
71
  USER user
72
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
73
 
74
+ # Copy application files
75
  COPY --chown=user:user . /app
76
 
77
+ # Install any remaining user requirements
78
  COPY --chown=user:user requirements.txt /app/
79
  RUN pip install --user --no-deps -r requirements.txt || true
80