Spaces:
Runtime error
Runtime error
Download Dockerfile from iamudit02/attendx-api: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/iamudit02/attendx-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/iamudit02/attendx-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/iamudit02/attendx-api/resolve/main/Dockerfile
1.6 kB
| FROM python:3.11-slim | |
| # Prevent Python from buffering stdout/stderr and creating .pyc files | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| DEBIAN_FRONTEND=noninteractive | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system runtime dependencies required for OpenCV and image processing | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libgomp1 \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy and install python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Pre-create storage, exports, and models directories | |
| RUN mkdir -p /app/storage/models /app/storage/classroom_photos /app/storage/students /app/exports | |
| # Pre-download OpenCV ONNX models during build so the container starts immediately without network delay | |
| RUN curl -fsSL -o /app/storage/models/face_detection_yunet_2023mar.onnx \ | |
| https://github.com/opencv/opencv_zoo/raw/main/models/face_detection_yunet/face_detection_yunet_2023mar.onnx && \ | |
| curl -fsSL -o /app/storage/models/face_recognition_sface_2021dec.onnx \ | |
| https://github.com/opencv/opencv_zoo/raw/main/models/face_recognition_sface/face_recognition_sface_2021dec.onnx | |
| # Copy application source code | |
| COPY . . | |
| # Expose default Hugging Face Spaces port | |
| EXPOSE 7860 | |
| # Health check to ensure service is responding | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | |
| CMD curl -f http://localhost:7860/api/health || exit 1 | |
| CMD ["python", "app.py"] | |