|
| 1 | +# Base image for arm64 (Raspberry Pi 5). Build on the Pi directly, or use |
| 2 | +# `docker buildx build --platform linux/arm64` from another host. |
| 3 | +FROM python:3.11-slim |
| 4 | + |
| 5 | +WORKDIR /app |
| 6 | + |
| 7 | +# OpenCV + Hailo runtime dependencies. |
| 8 | +# libgl1: cv2 image codecs |
| 9 | +# libglib2.0-0, libsm6, libxext6, libxrender1: common cv2 dependencies |
| 10 | +# libgomp1: OpenMP (used by some opencv-python ops) |
| 11 | +# ffmpeg: standalone binary used by VideoAnalyzer for libx264 ultrafast |
| 12 | +# encoding (~5x faster than cv2's mp4v at 4K on Pi 5). |
| 13 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 14 | + libgl1 \ |
| 15 | + libglib2.0-0 \ |
| 16 | + libgomp1 \ |
| 17 | + libsm6 \ |
| 18 | + libxext6 \ |
| 19 | + libxrender1 \ |
| 20 | + ffmpeg \ |
| 21 | + && rm -rf /var/lib/apt/lists/* |
| 22 | + |
| 23 | +COPY requirements.txt . |
| 24 | +RUN pip install --no-cache-dir -r requirements.txt |
| 25 | + |
| 26 | +# Install the local HailoRT wheel. The user must place a wheel matching their |
| 27 | +# host driver version into hailort-packages/ before building this image. |
| 28 | +# Example filename: hailort-4.23.0-cp311-cp311-linux_aarch64.whl |
| 29 | +# |
| 30 | +# build-essential + python3-dev are needed to compile `netifaces`, a hailort |
| 31 | +# dependency that has no pre-built wheel for cp311/aarch64. They are removed |
| 32 | +# after install to keep the final image small. |
| 33 | +COPY hailort-packages/*.whl /tmp/ |
| 34 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 35 | + build-essential python3-dev \ |
| 36 | + && pip install --no-cache-dir /tmp/hailort-*.whl \ |
| 37 | + && apt-get purge -y --auto-remove build-essential python3-dev \ |
| 38 | + && rm -rf /var/lib/apt/lists/* \ |
| 39 | + && rm -f /tmp/*.whl |
| 40 | + |
| 41 | +COPY . . |
| 42 | + |
| 43 | +EXPOSE 8000 |
| 44 | + |
| 45 | +CMD ["python", "web_detection.py", "--model_path", "model/person_attr_resnet_v1_18.hef", "--video_path", "video/test.mp4"] |
0 commit comments