Spaces:
Sleeping
Sleeping
| FROM python:3.12-slim | |
| # Install system dependencies # | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| pkg-config \ | |
| python3-dev \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| # Set environment | |
| ENV HOME=/home/user | |
| ENV PATH="$HOME/.local/bin:$PATH" | |
| # Copy requirements and install Python packages as user | |
| COPY --chown=user requirements.txt /app/requirements.txt | |
| USER user | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r /app/requirements.txt | |
| # Copy application code | |
| COPY --chown=user src/ /app/src/ | |
| # Expose Streamlit port | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \ | |
| CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Run Streamlit | |
| ENTRYPOINT ["streamlit", "run", "/app/src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |