File size: 1,458 Bytes
938644a | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # βββ 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"]
|