File size: 808 Bytes
d0a567e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
# Use Python 3.10 as base
FROM python:3.10

# 1. Install System Dependencies (Poppler for images)
USER root
RUN apt-get update && apt-get install -y \
    poppler-utils \
    ffmpeg \
    libsm6 \
    libxext6 \
    && rm -rf /var/lib/apt/lists/*

# 2. Set up a new user "user" (Security requirement for HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 3. Set Working Directory
WORKDIR $HOME/app

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

# 5. Copy the Application Code & Data
COPY --chown=user . .

# 6. Expose the Port (Hugging Face expects port 7860)
EXPOSE 7860

# 7. Start the App
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]