# Use the official Python 3.11 slim image FROM python:3.11-slim # Set environment variables ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 # Install basic build tools and libraries (required by faiss-cpu, PyMuPDF, etc.) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ cmake \ libopenblas-dev \ libomp-dev \ poppler-utils \ && rm -rf /var/lib/apt/lists/* # Create a working directory WORKDIR /app # Set Hugging Face cache directory ENV HF_HOME=/app/cache RUN mkdir -p /app/cache && chmod -R 777 /app/cache # Copy requirements first (for Docker layer caching) COPY requirements.txt . # Install Python dependencies (no version pinning) RUN pip install --no-cache-dir -r requirements.txt # Create directories with proper read/write permissions RUN mkdir -p /app/uploads/vectors && chmod -R 777 /app/uploads # Copy the rest of the application files COPY . . # Expose the port used by your Flask app (e.g., 7860) EXPOSE 7860 # Start the Flask app #CMD ["python", "run.py"] # Run Gunicorn CMD ["gunicorn", "--bind", "0.0.0.0:7860", "wsgi:obj_app"]