Mahrufa commited on
Commit
3d0aa74
·
1 Parent(s): 756bd30

Add Docker support for FastAPI app

Browse files
Files changed (3) hide show
  1. .dockerignore +12 -0
  2. Dockerfile +19 -0
  3. README.md +25 -1
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .venv
3
+ __pycache__
4
+ .pytest_cache
5
+ *.pyc
6
+ chroma_db/
7
+ data/*.pdf
8
+ logs/*.log
9
+ .env
10
+ .DS_Store
11
+ Thumbs.db
12
+ Desktop.ini
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ COPY requirements.txt pyproject.toml ./
9
+
10
+ RUN pip install --no-cache-dir -r requirements.txt
11
+
12
+ COPY . .
13
+
14
+ RUN pip install --no-cache-dir -e . \
15
+ && mkdir -p data chroma_db logs
16
+
17
+ EXPOSE 8000
18
+
19
+ CMD ["python", "-m", "uvicorn", "clinical_rag_eval.api:app", "--host", "0.0.0.0", "--port", "8000"]
README.md CHANGED
@@ -183,6 +183,31 @@ Available endpoints:
183
 
184
  The upload endpoint does not automatically ingest documents. After uploading PDFs, run `python -m clinical_rag_eval.ingest` to rebuild the vector store. API logs are written to `logs/api.log`; uploaded file contents are not logged.
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  ### API Documentation
187
 
188
  ![FastAPI Docs Overview](docs/screenshots/fastapi-docs-overview.png)
@@ -335,7 +360,6 @@ Exact comparison metrics are written to `results/embedding_comparison.json` and
335
 
336
  - Additional API hardening, including request validation, rate limiting, and deployment configuration.
337
  - Broader retrieval evaluation metrics such as nDCG and graded relevance labels.
338
- - Docker packaging for reproducible deployment.
339
  - Authentication for API access.
340
  - Audit logging for document ingestion and retrieval events.
341
  - RAG answer generation with citation-aware responses.
 
183
 
184
  The upload endpoint does not automatically ingest documents. After uploading PDFs, run `python -m clinical_rag_eval.ingest` to rebuild the vector store. API logs are written to `logs/api.log`; uploaded file contents are not logged.
185
 
186
+ ## Docker
187
+
188
+ Build the image:
189
+
190
+ ```bash
191
+ docker build -t clinical-rag-evaluation-framework .
192
+ ```
193
+
194
+ Run the API:
195
+
196
+ ```bash
197
+ docker run -p 8000:8000 clinical-rag-evaluation-framework
198
+ ```
199
+
200
+ Then open:
201
+
202
+ - `http://127.0.0.1:8000/health`
203
+ - `http://127.0.0.1:8000/docs`
204
+
205
+ Local PDFs and ChromaDB indexes are not committed to Git. For real usage, mount local folders for `data/`, `chroma_db/`, and `logs/` so documents, vector indexes, and API logs persist outside the container:
206
+
207
+ ```bash
208
+ docker run -p 8000:8000 -v ${PWD}/data:/app/data -v ${PWD}/chroma_db:/app/chroma_db -v ${PWD}/logs:/app/logs clinical-rag-evaluation-framework
209
+ ```
210
+
211
  ### API Documentation
212
 
213
  ![FastAPI Docs Overview](docs/screenshots/fastapi-docs-overview.png)
 
360
 
361
  - Additional API hardening, including request validation, rate limiting, and deployment configuration.
362
  - Broader retrieval evaluation metrics such as nDCG and graded relevance labels.
 
363
  - Authentication for API access.
364
  - Audit logging for document ingestion and retrieval events.
365
  - RAG answer generation with citation-aware responses.