| |
| 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 |
|
|
| |
| RUN mkdir -p \ |
| /app/.files \ |
| /app/.chainlit \ |
| /app/.cache \ |
| /app/model_cache \ |
| /app/vectorstore/db_faiss \ |
| /app/data && \ |
| chmod -R a+rwx /app/.files /app/.chainlit /app/.cache /app/model_cache /app/vectorstore /app/data |
|
|
| |
| 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 |
|
|
| |
| 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')\ |
| " |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["sh", "-c", "\ |
| python download_assets.py && \ |
| exec chainlit run model.py --host 0.0.0.0 --port 7860\ |
| "] |
|
|