Spaces:
Sleeping
Sleeping
| # Multi-stage build for standalone deployment | |
| FROM python:3.10-slim as base | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PIP_NO_CACHE_DIR=1 | |
| ENV PIP_DISABLE_PIP_VERSION_CHECK=1 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| gcc \ | |
| g++ \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p data models logs | |
| # Expose port | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:8501/_stcore/health || exit 1 | |
| # Start command | |
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"] | |