Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +25 -8
Dockerfile
CHANGED
|
@@ -1,13 +1,30 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a slim Python base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies for OpenCV
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
libgl1-mesa-glx \
|
| 7 |
+
libglib2.0-0 \
|
| 8 |
+
ffmpeg \
|
| 9 |
+
libsm6 \
|
| 10 |
+
libxext6 \
|
| 11 |
+
git
|
| 12 |
|
| 13 |
+
# Set the working directory
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
+
# Copy the requirements file and install dependencies
|
| 17 |
+
COPY requirements.txt .
|
| 18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Copy your application code
|
| 21 |
+
COPY . .
|
| 22 |
+
|
| 23 |
+
# Download the YOLOv8 model (alternatively, ensure it's copied with your app)
|
| 24 |
+
RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
|
| 25 |
+
|
| 26 |
+
# Expose the port Hugging Face Spaces expects
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Command to run your Flask app with Gunicorn
|
| 30 |
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]
|