RAG / docker-compose.yml
JenishMakwana's picture
Initial clean commit
69524c2
Raw
History Blame Contribute Delete
2.79 kB
services:
# ── Qdrant Vector Database ──────────────────────────────────────────────────
qdrant:
image: qdrant/qdrant:latest
container_name: rag_qdrant
restart: unless-stopped
ports:
- "6333:6333" # HTTP API
- "6334:6334" # gRPC API
volumes:
- qdrant_data:/qdrant/storage
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/6333' 2>/dev/null && exit 0 || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
# ── PostgreSQL (optional – only used when USE_POSTGRES=true) ────────────────
postgres:
image: postgres:16-alpine
container_name: rag_postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-legal_rag}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
# ── FastAPI Backend ─────────────────────────────────────────────────────────
backend:
build:
context: . # project root — gives access to requirements.txt
dockerfile: backend/Dockerfile
container_name: rag_backend
restart: unless-stopped
env_file:
- .env
environment:
# Override DB host to point to the postgres container
POSTGRES_SERVER: postgres
# Point Qdrant client to the qdrant container over HTTP
QDRANT_URL: http://qdrant:6333
ports:
- "8001:8001"
volumes:
# Persist SQLite DB and uploaded documents
- backend_data:/app/app/data
depends_on:
qdrant:
condition: service_started
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/docs"]
interval: 20s
timeout: 15s
retries: 15
start_period: 300s # InLegalBERT + BGE reranker can take 3-5 min to load
# ── React Frontend (Nginx) ──────────────────────────────────────────────────
frontend:
build:
context: ./frontend-react
dockerfile: Dockerfile
container_name: rag_frontend
restart: unless-stopped
ports:
- "8080:80"
depends_on:
- backend
volumes:
qdrant_data:
postgres_data:
backend_data: