# Use a Python base image FROM python:3.13.5-slim # Create a non-root user and set permissions RUN useradd -m -u 1000 user USER user ENV HOME=/home/user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR $HOME/app # Copy and install dependencies COPY --chown=user:user requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt # Copy application source code COPY --chown=user:user src/ ./src/ # Set environment variables for Streamlit and Hugging Face libraries ENV STREAMLIT_SERVER_GATHER_USAGE_STATS="false" \ HF_HOME="/tmp/huggingface" # Expose the port and set the entrypoint EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]