From 40c322ad472c4ce3b16211af77487107964cf723 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Tue, 29 Sep 2020 16:32:04 -0500 Subject: [PATCH] arm64 support --- docker/Dockerfile.arm64 | 17 +++++++ docker/{Dockerfile.rpi => Dockerfile.armv7hf} | 0 docker/Dockerfile.wheels | 2 +- docker/Dockerfile.wheels.arm64 | 49 +++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile.arm64 rename docker/{Dockerfile.rpi => Dockerfile.armv7hf} (100%) create mode 100644 docker/Dockerfile.wheels.arm64 diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 000000000..7e7fce6c7 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,17 @@ +FROM frigate-base +LABEL maintainer "blakeb@blakeshome.com" + +ENV DEBIAN_FRONTEND=noninteractive +# Install packages for apt repo +RUN apt-get -qq update \ + && apt-get -qq install --no-install-recommends -y \ + ffmpeg \ + # runtime dependencies + libopenexr24 \ + libgstreamer1.0-0 \ + libgstreamer-plugins-base1.0-0 \ + libopenblas-base \ + ## Tensorflow lite + && pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp38-cp38-linux_aarch64.whl \ + && rm -rf /var/lib/apt/lists/* \ + && (apt-get autoremove -y; apt-get autoclean -y) \ No newline at end of file diff --git a/docker/Dockerfile.rpi b/docker/Dockerfile.armv7hf similarity index 100% rename from docker/Dockerfile.rpi rename to docker/Dockerfile.armv7hf diff --git a/docker/Dockerfile.wheels b/docker/Dockerfile.wheels index 6c667e855..15f244671 100644 --- a/docker/Dockerfile.wheels +++ b/docker/Dockerfile.wheels @@ -18,7 +18,7 @@ RUN apt-get -qq update \ gcc gfortran libopenblas-dev liblapack-dev cython RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ - && python3 get-pip.py wheel==0.34.2 + && python3 get-pip.py RUN pip3 install scikit-build diff --git a/docker/Dockerfile.wheels.arm64 b/docker/Dockerfile.wheels.arm64 new file mode 100644 index 000000000..006f569cf --- /dev/null +++ b/docker/Dockerfile.wheels.arm64 @@ -0,0 +1,49 @@ +FROM ubuntu:20.04 as build + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -qq update \ + && apt-get -qq install -y \ + python3 \ + python3-dev \ + wget \ + # opencv dependencies + build-essential cmake git pkg-config libgtk-3-dev \ + libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ + libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ + gfortran openexr libatlas-base-dev libssl-dev\ + libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ + libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \ + # scipy dependencies + gcc gfortran libopenblas-dev liblapack-dev cython + +RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ + && python3 get-pip.py + +# need to build cmake from source because binary distribution is broken for arm64 +# https://github.com/scikit-build/cmake-python-distributions/issues/115 +# https://github.com/skvark/opencv-python/issues/366 +# https://github.com/scikit-build/cmake-python-distributions/issues/96#issuecomment-663062358 +RUN pip3 install scikit-build + +RUN git clone https://github.com/scikit-build/cmake-python-distributions.git \ + && cd cmake-python-distributions/ \ + && python3 setup.py bdist_wheel + +RUN pip3 install cmake-python-distributions/dist/*.whl + +RUN pip3 wheel --wheel-dir=/wheels \ + opencv-python-headless \ + numpy \ + imutils \ + scipy \ + psutil \ + Flask \ + paho-mqtt \ + PyYAML \ + matplotlib \ + click + +FROM scratch + +COPY --from=build /wheels /wheels