FROM python:3.9-slim # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ ffmpeg \ libsm6 \ libxext6 \ && rm -rf /var/lib/apt/lists/* # Set up working directory WORKDIR /app # Create cache directories with proper permissions RUN mkdir -p \ /tmp/transformers_cache \ /tmp/huggingface \ /tmp/whisper_cache && \ chmod -R 777 /tmp # Set environment variables ENV TRANSFORMERS_CACHE=/tmp/transformers_cache ENV HF_HOME=/tmp/huggingface ENV WHISPER_CACHE_DIR=/tmp/whisper_cache # Copy requirements first to leverage Docker cache COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]