Sunnycodes3114 commited on
Commit
32e8759
·
verified ·
1 Parent(s): e397e78

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -13
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use Python base image
2
  FROM python:3.10-slim
3
 
4
  # Install system dependencies
@@ -8,25 +8,33 @@ RUN apt-get update && apt-get install -y \
8
  libsm6 \
9
  libxext6 \
10
  cmake \
 
 
 
11
  libgl1-mesa-glx \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install pip and essential Python libraries
15
- RUN pip install --no-cache-dir \
16
- torch==1.13.1+cpu \
17
- torchvision==0.14.1+cpu \
18
- git+https://github.com/facebookresearch/detectron2.git \
19
- gradio \
20
- requests \
21
- opencv-python \
22
- Pillow \
23
- numpy
 
 
24
 
25
  # Set the working directory
26
  WORKDIR /app
27
 
28
- # Copy the application code
29
  COPY . .
30
 
31
- # Set the entry point for the container
 
 
 
32
  CMD ["python", "app.py"]
 
1
+ # Base image for Python
2
  FROM python:3.10-slim
3
 
4
  # Install system dependencies
 
8
  libsm6 \
9
  libxext6 \
10
  cmake \
11
+ gcc \
12
+ g++ \
13
+ ninja-build \
14
  libgl1-mesa-glx \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Upgrade pip
18
+ RUN pip install --no-cache-dir --upgrade pip
19
+
20
+ # Install PyTorch and torchvision
21
+ RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
22
+
23
+ # Install Detectron2
24
+ RUN python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
25
+
26
+ # Install other Python dependencies
27
+ COPY requirements.txt /tmp/requirements.txt
28
+ RUN pip install --no-cache-dir -r /tmp/requirements.txt
29
 
30
  # Set the working directory
31
  WORKDIR /app
32
 
33
+ # Copy application files
34
  COPY . .
35
 
36
+ # Expose port for Gradio
37
+ EXPOSE 7860
38
+
39
+ # Run the application
40
  CMD ["python", "app.py"]