# Use official Python slim image FROM python:3.11-slim # Set environment variables # Optional: Disable Usage Stats (telemetry) for Privacy / Stability ENV STREAMLIT_DISABLE_USAGE_STATS=true # Install dependencies RUN apt-get update && apt-get install -y \ software-properties-common \ build-essential \ curl \ git \ gfortran \ gcc \ g++ \ libopenblas-dev \ liblapack-dev \ ffmpeg \ graphviz \ && rm -rf /var/lib/apt/lists/* # switch to a user that works for spaces # RUN useradd --create-home --uid 1000 --shell /bin/bash user RUN useradd -m -u 1000 -s /bin/bash user USER user # Update PATH to include user base binary directory ENV HOME=/home/user \ PATH="/home/user/.local/bin:${PATH}" # Set working directory inside container WORKDIR /app # Copy source and requirements (ownership already belongs to user) COPY --chown=user:user requirements.txt ./ COPY --chown=1000 src/ ./src/ # Install Python dependencies RUN pip install --no-cache-dir --user -r requirements.txt # Expose port EXPOSE 8501 # Health check HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health # Run Streamlit with no browser, on all interfaces ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]