FROM python:3.10-slim WORKDIR /app RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Set HOME so Streamlit & HuggingFace use /app ENV HOME=/app ENV STREAMLIT_HOME=$HOME/.streamlit ENV TRANSFORMERS_CACHE=$HOME/.cache/huggingface ENV HF_HOME=$HOME/.cache/huggingface ENV HF_DATASETS_CACHE=$HOME/.cache/huggingface ENV HF_METRICS_CACHE=$HOME/.cache/huggingface # Create writable dirs RUN mkdir -p $HOME/.streamlit $HOME/.cache/huggingface && chmod -R 777 $HOME/.streamlit $HOME/.cache RUN mkdir -p /tmp && chmod -R 777 /tmp COPY requirements.txt ./ COPY src/ ./src/ RUN pip3 install --upgrade pip setuptools wheel RUN pip3 install --no-cache-dir -r requirements.txt 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"]