BrandSightAI / Dockerfile
akashjayampu's picture
Update Dockerfile
d3c2b88 verified
Raw
History Blame Contribute Delete
1.38 kB
# Use lightweight python 3.9 image
FROM python:3.9-slim
WORKDIR /app
# Install system deps
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl && \
rm -rf /var/lib/apt/lists/*
# Set Hugging Face cache path
ENV HF_HOME=/app/model_cache
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
# Copy files
COPY requirements.txt ./
COPY .streamlit/ .streamlit/
COPY src/ ./src/
# Install Python deps
RUN pip install --no-cache-dir -r requirements.txt
# Create cache and config dirs with permissions
RUN mkdir -p /app/model_cache && chmod -R 777 /app/model_cache
RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
# Pre-download models to cache
RUN python -c "from transformers import pipeline; pipeline('zero-shot-classification', model='facebook/bart-large-mnli')" && \
python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')" && \
python -c "from transformers import pipeline; pipeline('summarization', model='sshleifer/distilbart-cnn-6-6')" && \
python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]