# 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"]