dev2008/audio-separation
0
1# Use official lightweight Python image2FROM python:3.11-slim3 4# Install system dependencies for audio processing (ffmpeg, libsndfile)5RUN apt-get update && apt-get install -y \6 ffmpeg \7 libsndfile1 \8 git \9 && rm -rf /var/lib/apt/lists/*10 11# Set working directory12WORKDIR /app13 14# Copy requirements file15COPY requirements.txt .16 17# Install dependencies (use cpu versions of torch/torchaudio to save container size)18RUN pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu19 20# Copy the rest of the project files21COPY . .22 23# Set environment variables for FastAPI and dataset locations24ENV DATA_ROOT=/app/data/ESC-50-master25ENV PORT=786026ENV PYTHONPATH=/app/src27 28# Ensure output directories exist and are writable by the Hugging Face container user (UID 1000)29RUN mkdir -p /app/outputs/img /app/outputs/audio /app/outputs/uploads && chmod -R 777 /app/outputs30 31# Expose port 7860 (Hugging Face Spaces default port)32EXPOSE 786033 34# Command to run the FastAPI app35CMD ["uvicorn", "src.server:app", "--host", "0.0.0.0", "--port", "7860"]36 