File size: 1,391 Bytes
7ecdf4a
20edea9
 
 
 
 
 
 
e7c1485
 
20edea9
 
7ecdf4a
20edea9
 
 
 
 
 
e7c1485
20edea9
e7c1485
 
 
20edea9
 
 
e7c1485
 
 
 
20edea9
e7c1485
 
20edea9
e7c1485
 
 
20edea9
e7c1485
 
20edea9
e7c1485
 
20edea9
 
 
 
 
 
e7c1485
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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"]