FROM python:3.11-slim AS base ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ HF_HOME=/app/.cache/huggingface \ TRANSFORMERS_CACHE=/app/.cache/huggingface WORKDIR /app # System deps for soundfile / librosa (libsndfile + ffmpeg for mp3/ogg). RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libsndfile1 \ ffmpeg \ curl \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install --upgrade pip \ && pip install -r /app/requirements.txt COPY app /app/app COPY checkpoints /app/checkpoints # Pre-create writable dirs RUN mkdir -p /app/tmp_uploads /app/.cache/huggingface EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \ CMD curl -fsS http://localhost:8000/api/health || exit 1 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]