Spaces:
Sleeping
Sleeping
| # Dockerfile — must be in repo root (not in /server) | |
| FROM python:3.11-slim | |
| # Enable web interface for testing at /web | |
| ENV ENABLE_WEB_INTERFACE=true | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| g++ \ | |
| make \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for layer caching | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all source files (includes pre-built database) | |
| COPY . . | |
| # Expose the server port | |
| EXPOSE 8000 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | |
| CMD python -c "import requests; requests.post('http://localhost:8000/reset', json={'task': 'easy'}, timeout=5)" || exit 1 | |
| # Start the FastAPI server | |
| CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"] | |