# Use a lightweight Python image FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Copy requirements file and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Ensure necessary libraries for Hugging Face and document processing RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy application files COPY . . # Expose the port Flask runs on EXPOSE 7860 # Set environment variables for better CPU performance ENV TOKENIZERS_PARALLELISM=false \ TRANSFORMERS_OFFLINE=1 \ HF_DATASETS_OFFLINE=1 # Run the application using Gunicorn with multiple workers CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]