Spaces:
Running
Running
FROM python:3.10.0-slim | |
# Install system dependencies for PyAudio (PortAudio) and general build tools | |
USER root | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
build-essential \ | |
portaudio19-dev \ | |
libsndfile1 && \ | |
rm -rf /var/lib/apt/lists/* | |
# Create a non-root user (per HF Spaces best practices) | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
WORKDIR /app | |
# Copy and install Python requirements | |
COPY --chown=user requirements.txt . | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY --chown=user . . | |
# Expose the Gradio/Uvicorn port | |
EXPOSE 7860 | |
# Launch the FastAPI + Gradio server | |
CMD ["uvicorn", "inference:app", "--host", "0.0.0.0", "--port", "7860"] | |