FROM python:3.11-slim # System deps RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies first (layer caching) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy source COPY . . # Create __init__.py files if missing RUN touch env/__init__.py graders/__init__.py server/__init__.py # Expose port (HF Spaces uses 7860) EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:7860/ || exit 1 # Start FastAPI server CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]