| # Use a minimal base image with Python 3.9 installed | |
| FROM python:3.9 | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set working directory | |
| WORKDIR $HOME/app | |
| # Copy files | |
| COPY --chown=user . $HOME/app | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Expose port | |
| EXPOSE 8501 | |
| # Run Streamlit | |
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"] | |