Deevyankar commited on
Commit
6bb3589
·
verified ·
1 Parent(s): a0d17ed

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -12
Dockerfile CHANGED
@@ -1,26 +1,40 @@
1
  FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
2
 
3
- # Install Python 3.10 and system dependencies
4
- RUN apt-get update && \
5
- apt-get install -y python3.10 python3.10-dev python3-pip git libgl1-mesa-glx libglib2.0-0 ffmpeg && \
6
- ln -s /usr/bin/python3.10 /usr/bin/python
 
 
7
 
8
  # Set working directory
9
  WORKDIR /app
10
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # Clone YOLOv7 repository
12
  RUN git clone https://github.com/WongKinYiu/yolov7.git
13
 
14
- # Copy all app files into container
15
- COPY . /app
16
-
17
- # Upgrade pip and install Python dependencies
18
- RUN pip install --upgrade pip
19
- RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Run Streamlit app on container start
22
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
23
 
 
 
24
 
 
 
25
 
26
 
 
1
  FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
2
 
3
+ # Use the official Python image as the base
4
+ FROM python:3.10-slim
5
+
6
+ # Set environment variables
7
+ ENV PYTHONDONTWRITEBYTECODE=1
8
+ ENV PYTHONUNBUFFERED=1
9
 
10
  # Set working directory
11
  WORKDIR /app
12
 
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y \
15
+ git \
16
+ ffmpeg \
17
+ libsm6 \
18
+ libxext6 \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ # Install Python dependencies
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
  # Clone YOLOv7 repository
26
  RUN git clone https://github.com/WongKinYiu/yolov7.git
27
 
28
+ # Copy application files
29
+ COPY . .
 
 
 
 
30
 
31
+ # Modify torch.load to set weights_only=False
32
+ RUN sed -i 's/torch.load(\(.*\))/torch.load(\1, weights_only=False)/g' yolov7/models/experimental.py
33
 
34
+ # Expose the port Streamlit runs on
35
+ EXPOSE 8501
36
 
37
+ # Run the application
38
+ CMD ["streamlit", "run", "app.py"]
39
 
40