# Use a minimal base image with Python 3.9 installed FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Copy requirements first (better caching for builds) COPY requirements.txt . # Install Python dependencies RUN pip3 install --no-cache-dir -r requirements.txt # Create non-root user for security RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory for the new user WORKDIR $HOME/app # Copy application files with correct ownership COPY --chown=user . $HOME/app # Expose Streamlit port EXPOSE 8501 # Run the Streamlit app CMD ["streamlit", "run", "app.py", \ "--server.port=8501", \ "--server.address=0.0.0.0", \ "--server.enableXsrfProtection=false"]