FROM python:3.9-slim # 1) Set working directory WORKDIR /app # 2) Make /app the home directory so HOME/.streamlit is writable ENV HOME=/app # 3) Copy code COPY . . # 4) Install dependencies RUN pip install --no-cache-dir -r requirements.txt -# 5) Pre-create the Streamlit config folder (now under /app/.streamlit) -RUN mkdir -p /app/.streamlit \ - && printf "[server]\nheadless = true\nport = 7860\n\n" \ - > /app/.streamlit/config.toml +# 5) Pre-create the Streamlit config folder and open up permissions +RUN mkdir -p /app/.streamlit \ + && printf "[server]\nheadless = true\nport = 7860\n\n" > /app/.streamlit/config.toml \ + && chmod -R a+rwx /app/.streamlit # 6) Expose port and run EXPOSE 7860 CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]