# Use official Python runtime as base image FROM python:3.12-slim # Set working directory in container WORKDIR /app # Copy requirements first (optimizes caching) COPY requirements.txt . # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . . # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Set environment variables (optional, adjust as needed) ENV FLASK_ENV=production ENV PORT=7860 # Command to run the app with Gunicorn (adjust workers/threads as needed) CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "0", "recommend_app:app"]