Spaces:
Sleeping
Sleeping
| # Use Python 3.13 slim image as base | |
| FROM python:3.13-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies for OpenCV, yt-dlp, and network tools | |
| RUN apt-get update && apt-get install -y \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgomp1 \ | |
| libgl1 \ | |
| ffmpeg \ | |
| ca-certificates \ | |
| dnsutils \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements file | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY . . | |
| # Create required directories | |
| RUN mkdir -p thumbnails static /tmp/Ultralytics | |
| # Set proper permissions | |
| # 755 = rwxr-xr-x (owner: read/write/execute, group: read/execute, others: read/execute) | |
| # 777 = rwxrwxrwx (full permissions for all - used for directories that need write access) | |
| RUN chmod -R 755 static && \ | |
| chmod -R 777 thumbnails && \ | |
| chmod -R 777 /tmp/Ultralytics | |
| # Create a non-root user for security (optional but recommended) | |
| # Uncomment the following lines if you want to run as non-root user | |
| # RUN useradd -m -u 1000 appuser && \ | |
| # chown -R appuser:appuser /app /tmp/Ultralytics | |
| # USER appuser | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |