|
|
|
FROM python:3.10-slim
|
|
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
build-essential \
|
|
git \
|
|
poppler-utils \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV TRANSFORMERS_CACHE=/app/model_cache
|
|
ENV HF_HOME=/app/model_cache
|
|
ENV TORCH_HOME=/app/model_cache
|
|
ENV CHAINLIT_HOST=0.0.0.0
|
|
ENV CHAINLIT_PORT=7860
|
|
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
RUN mkdir -p /app/model_cache /app/vectorstore/db_faiss /app/data
|
|
|
|
|
|
COPY model.py ingest.py chainlit.md download_assets.py ./
|
|
|
|
|
|
RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \
|
|
AutoTokenizer.from_pretrained('google/flan-t5-base'); \
|
|
AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base'); \
|
|
from sentence_transformers import SentenceTransformer; \
|
|
SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
|
|
|
|
|
|
RUN python download_assets.py
|
|
|
|
|
|
EXPOSE 7860
|
|
|
|
|
|
CMD ["chainlit", "run", "model.py", "--host", "0.0.0.0", "--port", "7860"] |