FROM python:3.10-slim WORKDIR /app # Install system dependencies + Streamlit requirements RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ gcc \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies first for caching COPY requirements.txt . RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Verify Streamlit installation RUN which streamlit && streamlit --version # Copy application files COPY . . # Set up non-root user RUN useradd -m appuser && chown -R appuser:appuser /app USER appuser # Health check (optional but recommended) HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 # Run Streamlit CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]