File size: 1,037 Bytes
79a28b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Keep Python output unbuffered and avoid .pyc files in containers.
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1

# Optional Hugging Face cache location inside the container.
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface

WORKDIR /app

# System libs often needed by ML wheels/runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
	git \
	build-essential \
	&& rm -rf /var/lib/apt/lists/*

# Install Python dependencies used by Fastapi/main.py.
RUN pip install --upgrade pip && pip install \
	fastapi \
	"uvicorn[standard]" \
	numpy \
	faiss-cpu \
	torch \
	transformers \
	huggingface_hub \
	sentencepiece \
	InstructorEmbedding \
	langchain-core \
	sentence-transformers \
	accelerate

# Copy the whole repo so Fastapi app can resolve vector_db.index/chunks.pkl
# from /app, /app/Fastapi, or /app/RAG_pipeline.
COPY . /app

EXPOSE 8000

# Run FastAPI app.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]