# Use a slim Python base FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # increase pip timeout to help larger downloads (optional) ENV PIP_DEFAULT_TIMEOUT=1200 # Install system deps (ffmpeg + build deps) RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg git build-essential curl libsm6 libxext6 libgl1 \ && rm -rf /var/lib/apt/lists/* # Install CPU-only PyTorch wheel first (smaller & reliable) # This installs a stable CPU build of torch & torchvision from official index RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu # Copy requirements and install everything else (do NOT include torch here) COPY requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt # Copy app and set workdir COPY . /app WORKDIR /app # Expose HF default port ENV PORT=7860 # Launch app CMD ["python", "app.py"]