# Use a minimal base image FROM python:3.9-slim # Create a non-root user RUN useradd -m -u 1000 user USER user # Set home directory and path ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory WORKDIR $HOME/app # Copy requirements first to leverage Docker cache COPY --chown=user requirements.txt $HOME/app/ RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the app files COPY --chown=user . $HOME/app/ # Run the Streamlit app CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]