File size: 751 Bytes
6192015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a slim Python image to keep the build fast
FROM python:3.9-slim

# Install system dependencies for audio processing (ffmpeg is required by librosa)
RUN apt-get update && apt-get install -y ffmpeg libsndfile1

WORKDIR /app

# Create a user to avoid running as root (Hugging Face security requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# Copy and install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your app code
COPY --chown=user . .

# Expose the default Hugging Face port
EXPOSE 7860

# Start the FastAPI server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]