FROM python:3.10-slim # Set up working directory WORKDIR /app # Create writable cache directory early RUN mkdir -p /app/cache && chmod 777 /app/cache # Set environment variables to use it ENV TRANSFORMERS_CACHE=/app/cache ENV TORCH_HOME=/app/cache ENV HF_HOME=/app/cache # Install required tools RUN apt-get update && apt-get install -y ffmpeg wget tar && rm -rf /var/lib/apt/lists/* # Copy and install Python deps COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN mkdir -p /app/cache/nltk_data && \ python -m nltk.downloader cmudict -d /app/cache/nltk_data # Copy all code COPY . . # Run the FastAPI app CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]