| # Base image | |
| FROM python:3.10-slim | |
| # Prevents python from writing pyc files to disk | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| # Ensures stdout and stderr are sent straight to the terminal without buffering | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set writable cache directories for Hugging Face / Transformers | |
| ENV TRANSFORMERS_CACHE=/tmp/transformers_cache | |
| ENV HF_HOME=/tmp/huggingface_cache | |
| # Copy requirements | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Copy project files | |
| COPY . . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run FastAPI app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |