| FROM python:3.11-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg libsndfile1 git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # HF Spaces sets HOME=/home/user for non-root user. Use that for caches. | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| PORT=7860 | |
| WORKDIR /home/user/app | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install --user --no-cache-dir -r requirements.txt | |
| COPY --chown=user:user app.py . | |
| COPY --chown=user:user static/ ./static/ | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |