Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +12 -1
Dockerfile
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# Install system dependencies for OpenCV
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
libgl1 \
|
| 6 |
libglib2.0-0 \
|
|
|
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
WORKDIR /app
|
| 10 |
|
|
|
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
|
|
|
| 14 |
COPY . .
|
| 15 |
|
|
|
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
| 1 |
+
# Use official Python slim image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Install system dependencies for OpenCV
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libgl1 \
|
| 7 |
libglib2.0-0 \
|
| 8 |
+
ffmpeg \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Set environment variables to avoid permission issues
|
| 12 |
+
ENV YOLO_CONFIG_DIR=/tmp/Ultralytics
|
| 13 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 14 |
+
|
| 15 |
+
# Set working directory
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
+
# Copy and install Python dependencies
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
+
# Copy the application code
|
| 23 |
COPY . .
|
| 24 |
|
| 25 |
+
# Expose Flask port
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Run Flask app
|
| 29 |
+
CMD ["python", "app.py"]
|