FROM python:3.12-slim-bullseye # Meta-data LABEL maintainer="Shuyib" \ description="RAG API pipeline that allows loading of documents, indexing and question" \ version="0.0" \ security_contact="check my github profile" # Install system deps RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Set working directory to be /app WORKDIR /app # Copy requirement files first for better layer caching COPY . /app # Install Python dependencies chain commands to reduce layers RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # keep the port consistent with Uvicorn/Gunicorn binding EXPOSE 7860 # Run Uvicorn with a production-ready worker CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "app:app", "-b", "0.0.0.0:7860", "--log-level", "info", "--timeout", "500"]