Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +26 -12
Dockerfile
CHANGED
|
@@ -1,26 +1,40 @@
|
|
| 1 |
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
| 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
|
| 15 |
-
COPY .
|
| 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 |
-
#
|
| 22 |
-
|
| 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 |
|