MindMedic / Dockerfile
MoizK's picture
initital commit
c7dc5b8 verified
raw
history blame
1.4 kB
# Use Python 3.10 slim image as base
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && \
apt-get install -y \
build-essential \
git \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Set environment variables
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
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary directories
RUN mkdir -p /app/model_cache /app/vectorstore/db_faiss /app/data
# Copy application files
COPY model.py ingest.py chainlit.md download_assets.py ./
# Download models and cache them
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')"
# Download assets from Hugging Face Hub
RUN python download_assets.py
# Expose the port Chainlit runs on
EXPOSE 7860
# Run the Chainlit application
CMD ["chainlit", "run", "model.py", "--host", "0.0.0.0", "--port", "7860"]