# ───────────────────────────────────────────── # Base image (lightweight Python) # ───────────────────────────────────────────── FROM python:3.10-slim # Prevent python from buffering stdout/stderr ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Set working directory WORKDIR /app # Install system dependencies (needed for torch, pandas, etc.) RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (better Docker caching) COPY requirements.txt . # Upgrade pip RUN pip install --upgrade pip # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy entire app COPY . . # Expose port (HF uses 7860 internally) EXPOSE 7860 # Start FastAPI using uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]