diff --git a/Dockerfile b/Dockerfile index 934b1b38c..7d687f796 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,17 +29,47 @@ RUN wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc # Download and Convert OpenVino model FROM base_amd64 AS ov-converter ARG DEBIAN_FRONTEND -RUN apt-get -qq update \ - && apt-get -qq install -y wget python3 python3-distutils -RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ - && python3 get-pip.py "pip" +# Install OpenVino Runtime and Dev library COPY requirements-ov.txt /requirements-ov.txt -RUN pip install -r /requirements-ov.txt +RUN apt-get -qq update \ + && apt-get -qq install -y wget python3 python3-distutils \ + && wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ + && python3 get-pip.py "pip" \ + && pip install -r /requirements-ov.txt + +# Get OpenVino Model +RUN mkdir /models \ + && cd /models && omz_downloader --name ssdlite_mobilenet_v2 \ + && cd /models && omz_converter --name ssdlite_mobilenet_v2 --precision FP16 + + +# libUSB - No Udev +FROM wget as libusb-build +ARG TARGETARCH +ARG DEBIAN_FRONTEND + +# Build libUSB without udev. Needed for Openvino NCS2 support +WORKDIR /opt +RUN apt-get update && apt-get install -y unzip build-essential automake libtool +RUN wget -q https://github.com/libusb/libusb/archive/v1.0.25.zip -O v1.0.25.zip && \ + unzip v1.0.25.zip && cd libusb-1.0.25 && \ + ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j $(nproc --all) +RUN apt-get update && \ + apt-get install -y --no-install-recommends libusb-1.0-0-dev && \ + rm -rf /var/lib/apt/lists/* +WORKDIR /opt/libusb-1.0.25/libusb +RUN /bin/mkdir -p '/usr/local/lib' && \ + /bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' && \ + /bin/mkdir -p '/usr/local/include/libusb-1.0' && \ + /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \ + /bin/mkdir -p '/usr/local/lib/pkgconfig' && \ + cd /opt/libusb-1.0.25/ && \ + /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + ldconfig -RUN mkdir /models -RUN cd /models && omz_downloader --name ssdlite_mobilenet_v2 -RUN cd /models && omz_converter --name ssdlite_mobilenet_v2 --precision FP16 FROM wget AS models @@ -106,6 +136,7 @@ RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt FROM scratch AS deps-rootfs COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/ COPY --from=go2rtc /rootfs/ / +COPY --from=libusb-build /usr/local/lib /usr/local/lib COPY --from=s6-overlay /rootfs/ / COPY --from=models /rootfs/ / COPY docker/rootfs/ / @@ -133,6 +164,8 @@ RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \ COPY --from=deps-rootfs / / +RUN ldconfig + EXPOSE 5000 EXPOSE 1935 EXPOSE 8554 diff --git a/docker/install_deps.sh b/docker/install_deps.sh index 0f6c5c1d3..66676651f 100755 --- a/docker/install_deps.sh +++ b/docker/install_deps.sh @@ -52,6 +52,7 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then # Use debian testing repo only for hwaccel packages echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list apt-get -qq update + # intel-opencl-icd specifically for GPU support in OpenVino apt-get -qq install --no-install-recommends --no-install-suggests -y \ intel-opencl-icd \ mesa-va-drivers libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 radeontop intel-gpu-tools diff --git a/requirements-wheels.txt b/requirements-wheels.txt index 2cb6c2a81..9952a2d72 100644 --- a/requirements-wheels.txt +++ b/requirements-wheels.txt @@ -3,7 +3,7 @@ Flask == 2.2.* imutils == 0.5.* matplotlib == 3.6.* mypy == 0.942 -numpy == 1.19.* +numpy == 1.22.* opencv-python-headless == 4.5.5.* paho-mqtt == 1.6.* peewee == 3.15.* @@ -18,4 +18,7 @@ scipy == 1.8.* setproctitle == 1.2.* ws4py == 0.5.* zeroconf == 0.39.4 -openvino == 2022.* +# Openvino Library - Custom built with MYRIAD support +openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-manylinux_2_31_x86_64.whl; platform_machine == 'x86_64' +openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-linux_aarch64.whl; platform_machine == 'aarch64' +openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-linux_armv7l.whl; platform_machine == 'armv7l'