Spaces:
Running
Running
| # NVIDIA CUDA base image for GPU support | |
| FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 | |
| # Environment variables to prevent interactive prompts | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && apt-get install -y \ | |
| software-properties-common \ | |
| && add-apt-repository ppa:deadsnakes/ppa \ | |
| && apt-get update && apt-get install -y \ | |
| python3.11 \ | |
| python3.11-dev \ | |
| python3.11-venv \ | |
| python3-pip \ | |
| git \ | |
| && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| RUN pip install --no-cache-dir --upgrade pip | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user . . | |
| # Create logs directory with proper permissions | |
| USER root | |
| RUN mkdir -p logs && chown -R user:user logs | |
| USER user | |
| # Expose Streamlit default port | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Run app | |
| CMD ["streamlit", "run", "app.py","--server.port=8501", "--server.address=0.0.0.0", "--server.headless=true", "--server.fileWatcherType=none", "--server.enableXsrfProtection=false", "--server.enableCORS=false"] | |