Spaces:
Sleeping
Sleeping
| # --------------------------------------------------------------------------- | |
| # Smart Contract Audit RL Environment | |
| # Hugging Face Space — Docker runtime | |
| # --------------------------------------------------------------------------- | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System deps | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python deps first (layer cache) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy project | |
| COPY . . | |
| # Create empty __init__ files if missing (safety) | |
| RUN touch env/__init__.py tasks/__init__.py tasks/task1/__init__.py \ | |
| tasks/task2/__init__.py tasks/task3/__init__.py \ | |
| data/__init__.py utils/__init__.py | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # Healthcheck | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Launch FastAPI | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |