File size: 822 Bytes
cecd86b
 
 
d819566
 
 
 
 
 
 
 
cecd86b
 
 
 
d819566
cecd86b
 
d819566
cecd86b
 
 
d819566
cecd86b
 
d819566
cecd86b
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
# 1. Use Python 3.9 Slim
FROM python:3.9-slim

# 2. Install essential system dependencies and SSL certificates as root
RUN apt-get update && apt-get install -y --no-install-recommends \

    ca-certificates \
    curl \
    && update-ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# 3. Create a non-root user (Hugging Face requirement: UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# 4. Set work directory
WORKDIR /app

# 5. Install Python Dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# 6. Copy the Application Code
COPY --chown=user . .

# 7. Run the Application on Hugging Face default port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]