# QModel 6 - Islamic RAG API # ============================= # Dockerfile for QModel API # Supports both Ollama and HuggingFace backends via .env configuration # # Build: docker build -t qmodel . # Run: docker run -p 8000:8000 --env-file .env qmodel FROM python:3.11-slim # Metadata LABEL maintainer="QModel Team" LABEL description="QModel v6 - Quran & Hadith RAG API" LABEL version="4.1" # Environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Set working directory WORKDIR /app # Install system dependencies # - build-essential: For compiling Python packages # - libopenblas-dev: For numerical operations (FAISS, numpy) # - libomp-dev: For OpenMP (FAISS parallelization) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libopenblas-dev \ libomp-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Expose port for API EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Start application # Configure via .env: LLM_BACKEND=ollama or LLM_BACKEND=hf CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]