Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Install basic dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Configure environment | |
| ENV PYTHONUNBUFFERED=1 | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all application files | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p logs state | |
| # Make supervisor executable | |
| RUN chmod +x supervisor.py | |
| # Health check - ensure web UI is responding | |
| HEALTHCHECK --interval=60s --timeout=30s --start-period=120s --retries=3 \ | |
| CMD python3 -c "import socket; s=socket.socket(); s.settimeout(2); s.connect(('localhost', 8000)); s.close()" || exit 1 | |
| # Start the application | |
| CMD ["python3", "app.py"] |