FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 WORKDIR /app # Copy requirements first for better caching COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Set PYTHONPATH to include the app directory ENV PYTHONPATH="/app" # Expose port (7860 for HF Spaces) EXPOSE 7860 # Start the server CMD ["gunicorn", "-b", "0.0.0.0:7860", "--workers", "1", "--threads", "2", "--timeout", "120", "server.api:app"]