File size: 557 Bytes
795c2a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 1. Use Lightweight Python
FROM python:3.10-slim

# 2. Set working folder
WORKDIR /app

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

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

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

# 6. CRITICAL: Run on Port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]