Spaces:
Sleeping
Sleeping
| # Use a lightweight Python image with CUDA support if possible | |
| # For HF Spaces, a standard Python image is often sufficient as they provide the drivers | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| # Install system dependencies for audio and building packages | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user (Hugging Face requirement for security) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Copy requirements and install | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY --chown=user . . | |
| # Expose the HF default port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "app.py"] |