File size: 723 Bytes
272d2d4
 
e8cb105
29c1be7
272d2d4
29c1be7
e8cb105
 
 
 
272d2d4
 
 
 
 
 
e8cb105
272d2d4
 
 
e8cb105
272d2d4
 
e8cb105
29c1be7
8f2bc5e
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
# 1. Use a standard Python image
FROM python:3.10-slim

# 2. Install system dependencies (Updated for Debian Trixie/Hugging Face)
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# 3. Set up the Hugging Face user (UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# 4. Copy requirements and install via pip
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# 5. Copy the rest of the project
COPY --chown=user . .

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