# Lightweight Python image FROM python:3.10-slim # System deps RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg git build-essential \ && rm -rf /var/lib/apt/lists/* # Make writable dirs for caches and NLTK RUN mkdir -p /data/nltk_data \ /data/huggingface/transformers \ /data/huggingface/datasets \ /data/tmp && chmod -R 777 /data # Point all caches to /data (writable) ENV NLTK_DATA=/data/nltk_data ENV HF_HOME=/data/huggingface ENV TRANSFORMERS_CACHE=/data/huggingface/transformers ENV HF_DATASETS_CACHE=/data/huggingface/datasets ENV TMPDIR=/data/tmp # Optional: choose Whisper size via env (ignored now if using SpeechRecognition) ENV WHISPER_MODEL=base WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . COPY README.md . # Spaces expects port 7860 ENV PORT=7860 # Start FastAPI CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]