FROM python:3.12.7 # Set environment #ENV HOME=/root ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache # Set environment variables ENV STREAMLIT_WATCHER_TYPE=none \ PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 # Create writable cache RUN mkdir -p /app/cache WORKDIR /app RUN apt-get update && apt-get install -y \ build-essential \ curl \ software-properties-common \ git \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt ./ COPY src/ ./src/ RUN pip3 install -r requirements.txt RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('setu4993/LaBSE')" # Preload sentence-transformers model into cache RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('intfloat/multilingual-e5-small')" # Download the model at build time (preload it into cache) RUN python3 -c "from transformers import pipeline; pipeline('question-answering', model='deepset/xlm-roberta-base-squad2')" EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0","--server.enableCORS=false","--server.enableXsrfProtection=false"]