# ─── SmartClass Edge Node ──────────────────────────────────────────── FROM python:3.11-slim AS base LABEL maintainer="SmartClass Team" LABEL description="SmartClass Edge Node - Face Recognition Pipeline" # System dependencies for OpenCV, FAISS, and camera access RUN apt-get update && apt-get install -y --no-install-recommends \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgomp1 \ libgl1-mesa-glx \ libv4l-dev \ wget \ curl \ && rm -rf /var/lib/apt/lists/* # Create non-root user RUN useradd -m -s /bin/bash smartclass WORKDIR /opt/smartclass # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy source code COPY src/ ./src/ COPY config/ ./config/ # Create data directories RUN mkdir -p /opt/smartclass/data/deploy \ /opt/smartclass/data/offline_queue \ /opt/smartclass/models \ && chown -R smartclass:smartclass /opt/smartclass # Set environment ENV PYTHONPATH=/opt/smartclass/src ENV PYTHONUNBUFFERED=1 # Switch to non-root user USER smartclass # Expose metrics port EXPOSE 9100 # Health check HEALTHCHECK --interval=15s --timeout=5s --retries=3 --start-period=45s \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9100/metrics')" # Start edge pipeline CMD ["python", "-m", "edge_pipeline"]