# ---- Base image ---- FROM python:3.10-slim # Useful runtime env ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # ---- Workdir ---- WORKDIR /app # ---- Python deps ---- COPY requirements.txt . # Keep OS deps minimal (only if needed for some wheels) RUN apt-get update && apt-get install -y --no-install-recommends \ && pip install --no-cache-dir -r requirements.txt \ && apt-get purge -y --auto-remove \ && rm -rf /var/lib/apt/lists/* # ---- App code ---- COPY . . COPY olist.sqlite /tmp/olist.sqlite # Streamlit & Matplotlib writable caches (mirrors the header you added in app.py) ENV HOME=/app \ XDG_CACHE_HOME=/app/.cache \ MPLCONFIGDIR=/app/.mplconfig \ STREAMLIT_SERVER_HEADLESS=true RUN mkdir -p /app/.streamlit /app/.cache /app/.mplconfig # (Optional) Streamlit server config – having this file in the repo also works # RUN printf "[server]\nheadless = true\nport = 7860\naddress = \"0.0.0.0\"\nenableCORS = false\nenableXsrfProtection = false\n" > /app/.streamlit/config.toml # ---- Network ---- EXPOSE 7860 # ---- Start ---- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false"]