FROM python:3.9-slim RUN groupadd --gid 1000 appuser && \ useradd --uid 1000 --gid 1000 -ms /bin/bash appuser WORKDIR /app RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt ./ COPY src/ ./src/ RUN pip install --no-cache-dir -r requirements.txt ENV HOME=/app # Create .streamlit config and set permissions RUN mkdir -p /app/.streamlit && \ echo "[server]\n\ enableCORS = false\n\ enableXsrfProtection = false\n\ " > /app/.streamlit/config.toml && \ chown -R appuser:appuser /app /app/.streamlit USER appuser EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]