FROM python:3.11-slim WORKDIR /app ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 # Install dependencies from requirements.txt COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # Copy all necessary files COPY . . # Expose the port expected by Hugging Face Spaces (default: 7860, but $PORT is set by HF) EXPOSE 7860 # Use gunicorn for production WSGI server ENV PORT=7860 CMD ["sh", "-c", "gunicorn -b 0.0.0.0:${PORT} app:APP"]