File size: 731 Bytes
3db0301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58f9f55
 
 
3db0301
 
 
 
58f9f55
3db0301
 
 
 
 
 
 
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
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /code

# Install python requirements
COPY requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy download script and pre-cache models inside image
COPY download_models.py /code/download_models.py
RUN python3 /code/download_models.py

# Copy application source
COPY . /code

# Change permissions to run under non-root user in HF Spaces
RUN chmod -R 777 /code

# Expose default port
EXPOSE 7860

# Run FastAPI app
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]