Spaces:
Sleeping
Sleeping
File size: 907 Bytes
8f7a08e 59906eb fc358be 8f7a08e fc358be 6fab709 8f7a08e fc358be 8f7a08e 59906eb 8f7a08e aac97c7 154ba4b 8f7a08e aa08e8d c3f60df 8f7a08e aa08e8d 8f7a08e fc358be aac97c7 fc358be aac97c7 aa08e8d c3f60df | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with network resilience
RUN pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir --default-timeout 100 -r requirements.txt
# Copy app code
COPY __init__.py .
COPY standalone_graders.py .
COPY app/ ./app/
COPY openenv.yaml .
COPY app.py .
COPY hf_spaces_run.py .
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Health check with curl
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run FastAPI app on port 7860 for HF Spaces compatibility
CMD ["python", "hf_spaces_run.py"]
|