File size: 818 Bytes
97a7505
68a4a19
97a7505
 
 
 
 
 
 
 
68a4a19
97a7505
68a4a19
 
 
 
 
 
97a7505
 
 
 
68a4a19
97a7505
 
 
 
 
 
 
97a4ae5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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"]