FROM python:3.10-slim # Install git (Hugging Face sometimes uses it for custom code) RUN apt-get update && \ apt-get install -y git && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # ✅ Create a safe writable cache folder RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache # ✅ Point HF + Transformers cache to that folder ENV HF_HOME=/app/hf_cache ENV TRANSFORMERS_CACHE=/app/hf_cache # Copy your Streamlit app COPY app.py . EXPOSE 8501 # Streamlit config ENV STREAMLIT_SERVER_HEADLESS=true ENV STREAMLIT_SERVER_PORT=8501 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 CMD ["streamlit", "run", "app.py"]