FROM python:3.9-slim # Create non-root user for security RUN useradd -m appuser && mkdir -p /app && chown -R appuser:appuser /app WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Create .streamlit directory and config file RUN mkdir -p /app/.streamlit && chown appuser:appuser /app/.streamlit COPY .streamlit/config.toml /app/.streamlit/ RUN chown appuser:appuser /app/.streamlit/config.toml # Copy application files COPY . . # Switch to non-root user USER appuser # Set default port ENV PORT=8501 EXPOSE 8501 CMD streamlit run app.py --server.port ${PORT} --server.fileWatcherType=none --logger.level=debug