FROM python:3.11-slim WORKDIR /app # Make Streamlit write to /app/.streamlit (not /.streamlit) and disable usage stats ENV PYTHONUNBUFFERED=1 \ PORT=7860 \ STREAMLIT_SERVER_HEADLESS=true \ STREAMLIT_BROWSER_GATHERUSAGESTATS=false \ STREAMLIT_CONFIG_DIR=/app/.streamlit \ HOME=/app # Minimal OS deps + tini RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates curl tini && rm -rf /var/lib/apt/lists/* # Python deps COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # App code COPY . . # Ensure config dir exists and has a config file RUN mkdir -p /app/.streamlit && \ printf "[browser]\ngatherUsageStats = false\n" > /app/.streamlit/config.toml && \ chmod -R 777 /app/.streamlit EXPOSE 7860 ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]