triton7777 commited on
Commit
3516513
·
1 Parent(s): e4c2a69
Files changed (1) hide show
  1. Dockerfile +12 -9
Dockerfile CHANGED
@@ -15,23 +15,26 @@ RUN apt-get update && apt-get install -y \
15
  # Set working directory
16
  WORKDIR /app
17
 
18
- # Install PyTorch first (CPU version unless you have GPU support in the base image)
19
- RUN pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2
20
 
21
- # Then install mmengine, mmcv, openmim
22
- RUN pip install mmengine mmcv-full openmim
23
 
24
- # Then install mmsegmentation
 
 
 
25
  RUN mim install mmsegmentation
26
 
27
- # Copy your files
28
  COPY . .
29
 
30
- # Install any other Python dependencies
31
- RUN pip install -r requirements.txt
32
 
33
  # Expose Gradio port
34
  EXPOSE 7860
35
 
36
- # Run app
37
  CMD ["python", "app.py"]
 
15
  # Set working directory
16
  WORKDIR /app
17
 
18
+ # Copy only requirements first to leverage Docker caching
19
+ COPY requirements.txt ./
20
 
21
+ # Install PyTorch (CPU version)
22
+ RUN pip install --no-cache-dir torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2
23
 
24
+ # Install OpenMMLab dependencies
25
+ RUN pip install --no-cache-dir mmengine mmcv-full openmim
26
+
27
+ # Install MMSegmentation using mim AFTER torch is present
28
  RUN mim install mmsegmentation
29
 
30
+ # Copy rest of the application code
31
  COPY . .
32
 
33
+ # Install remaining Python dependencies
34
+ RUN pip install --no-cache-dir -r requirements.txt
35
 
36
  # Expose Gradio port
37
  EXPOSE 7860
38
 
39
+ # Start the app
40
  CMD ["python", "app.py"]