FROM python:3.9-slim WORKDIR /app # Install required system packages RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential libgl1 libglib2.0-0 && \ apt-get clean && rm -rf /var/lib/apt/lists/* # Copy files COPY . /app # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Create writable cache directories with open permissions RUN mkdir -p /app/.streamlit /app/.config/matplotlib /app/tmp && \ chmod -R 777 /app/.streamlit /app/.config /app/tmp # Set environment variables to point to writable paths ENV MPLCONFIGDIR=/app/.config/matplotlib ENV TMPDIR=/app/tmp ENV STREAMLIT_BROWSER_GATHERUSAGESTATS=false ENV STREAMLIT_USAGE_STATISTICS=false # Expose Streamlit port EXPOSE 7860 # Run Streamlit app CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.maxUploadSize=25"]