| FROM python:3.9-slim | |
| # Create a non-root user | |
| RUN adduser --disabled-password --gecos '' streamlit-user | |
| WORKDIR /app | |
| COPY . . | |
| # Set Streamlit's config directory to the current working directory | |
| ENV STREAMLIT_SERVER_CONFIG_FILE=/app/.streamlit/config.toml | |
| # Add the user's local bin directory to the PATH | |
| ENV PATH="/home/streamlit-user/.local/bin:$PATH" | |
| # Install dependencies as the non-root user | |
| USER streamlit-user | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| EXPOSE 8080 | |
| CMD ["streamlit", "run", "app.py", "--server.port=8080", "--server.address=0.0.0.0"] | |