RamshaAnwar commited on
Commit
996d589
·
2 Parent(s): 0a372070e7b3a0

Merge branch 'master' of https://github.com/Ramsha-Anwar/context-query-ai

Browse files
Files changed (3) hide show
  1. .dockerignore +15 -0
  2. Dockerfile +39 -0
  3. render.yaml +41 -0
.dockerignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .venv
2
+ venv
3
+ __pycache__
4
+ *.pyc
5
+ .pytest_cache
6
+ .coverage
7
+ htmlcov
8
+ .env
9
+ .env.*
10
+ !.env.example
11
+ .git
12
+ tests
13
+ frontend
14
+ README.md
15
+ DATA_MODEL.md
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ---- Stage 1: Builder ----
2
+ FROM python:3.11.9-slim AS builder
3
+ WORKDIR /app
4
+
5
+ # Install build tools needed for Python packages
6
+ RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ COPY requirements.txt .
10
+ # Install dependencies into a specific folder
11
+ RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
12
+
13
+
14
+ # ---- Stage 2: Runtime ----
15
+ FROM python:3.11.9-slim
16
+ WORKDIR /app
17
+
18
+ # Install runtime libraries
19
+ RUN apt-get update && apt-get install -y --no-install-recommends libpq5 libgomp1 \
20
+ && rm -rf /var/lib/apt/lists/*
21
+
22
+ # Create a non-root user for Hugging Face compliance
23
+ RUN useradd -m -u 1000 user
24
+ USER user
25
+
26
+ # Copy the installed packages from the builder stage
27
+ COPY --from=builder /install /usr/local
28
+
29
+ # Copy our application code
30
+ COPY app ./app
31
+ COPY alembic ./alembic
32
+ COPY alembic.ini ./alembic.ini
33
+ COPY scripts ./scripts
34
+
35
+ # Hugging Face routes traffic to port 7860 by default
36
+ EXPOSE 7860
37
+
38
+ # Start the server, binding to the required port
39
+ CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port 7860"]
render.yaml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ - type: web
3
+ name: contextquery-api
4
+ runtime: docker
5
+ dockerfilePath: ./Dockerfile
6
+ healthCheckPath: /healthz
7
+ # This runs migrations BEFORE the new server goes live
8
+ preDeployCommand: alembic upgrade head
9
+ envVars:
10
+ - key: PYTHON_VERSION
11
+ value: 3.11.9
12
+ - key: ENVIRONMENT
13
+ value: production
14
+ - key: DATABASE_URL
15
+ sync: false
16
+ - key: DIRECT_DATABASE_URL
17
+ sync: false
18
+ - key: JWT_SECRET_KEY
19
+ sync: false
20
+ - key: GROQ_API_KEY
21
+ sync: false
22
+ - key: GROQ_MODEL
23
+ value: openai/gpt-oss-120b
24
+ - key: EMBEDDING_DIM
25
+ value: "768"
26
+ - key: CHUNK_SIZE_TOKENS
27
+ value: "500"
28
+ - key: CHUNK_OVERLAP_TOKENS
29
+ value: "50"
30
+ - key: INLINE_SYNC_MAX_CHARS
31
+ value: "20000"
32
+ - key: RAG_TOP_K
33
+ value: "5"
34
+ - key: RAG_MIN_SIMILARITY
35
+ value: "0.25"
36
+ - key: RAG_FAITHFULNESS_MIN
37
+ value: "0.70"
38
+ - key: RAG_RELEVANCY_MIN
39
+ value: "0.70"
40
+ - key: CORS_ORIGINS
41
+ sync: false