FROM python:3.11-slim WORKDIR /app RUN pip install --no-cache-dir --upgrade pip RUN apt-get update && apt-get install -y --no-install-recommends build-essential git curl && rm -rf /var/lib/apt/lists/* COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # Set HuggingFace cache path (to avoid permission or missing folder issues) ENV TRANSFORMERS_CACHE=/app/.cache/huggingface RUN mkdir -p /app/.cache/huggingface # Pre-download Persian model to avoid runtime errors RUN python -c "from langchain_huggingface import HuggingFaceEmbeddings; HuggingFaceEmbeddings(model_name='HooshvareLab/bert-base-parsbert-uncased', cache_folder='/app/.cache/huggingface')" COPY . . EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]