From 53e6f083b95399ca2a01dfd0f206f5ba082773fb Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 8 Jun 2023 09:46:38 -0700 Subject: [PATCH] docker: working jammy + tflite --- install/docker/Dockerfile | 2 +- install/docker/Dockerfile.HEAD | 2 +- install/docker/Dockerfile.full | 86 +++++++++++-------- install/docker/Dockerfile.lite | 44 ++++++---- install/docker/Dockerfile.nvidia | 2 +- install/docker/Dockerfile.s6 | 2 +- install/docker/Dockerfile.thin | 17 ++-- install/docker/docker-build-nvidia.sh | 2 +- install/docker/docker-build.sh | 3 +- .../docker/template/Dockerfile.full.header | 86 +++++++++++-------- 10 files changed, 137 insertions(+), 109 deletions(-) diff --git a/install/docker/Dockerfile b/install/docker/Dockerfile index 0a194957a..48adb114c 100644 --- a/install/docker/Dockerfile +++ b/install/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE="18-bullseye-full" +ARG BASE="18-jammy-full" FROM koush/scrypted-common:${BASE} WORKDIR / diff --git a/install/docker/Dockerfile.HEAD b/install/docker/Dockerfile.HEAD index 36b40da1f..1ad3be782 100644 --- a/install/docker/Dockerfile.HEAD +++ b/install/docker/Dockerfile.HEAD @@ -1,4 +1,4 @@ -ARG BASE="16-bullseye" +ARG BASE="16-jammy" FROM koush/scrypted-common:${BASE} WORKDIR / diff --git a/install/docker/Dockerfile.full b/install/docker/Dockerfile.full index c53bd3558..caa8b93d0 100644 --- a/install/docker/Dockerfile.full +++ b/install/docker/Dockerfile.full @@ -6,23 +6,40 @@ # This common file will be used by both Docker and the linux # install script. ################################################################ -ARG BASE="bullseye" +ARG BASE="jammy" FROM ubuntu:${BASE} as header -RUN apt-get update && apt-get -y install curl wget +ENV DEBIAN_FRONTEND=noninteractive + +# base tools and development stuff +RUN apt-get update && apt-get -y install \ + curl wget software-properties-common apt-utils \ + build-essential \ + cmake \ + gcc \ + libcairo2-dev \ + libgirepository1.0-dev \ + pkg-config && \ + apt-get -y update && \ + apt-get -y upgrade -# switch to nvm? ARG NODE_VERSION=18 -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get update && apt-get install -y nodejs + +# python native +RUN apt-get -y install \ + python3 \ + python3-dev\ + python3-gst-1.0 \ + python3-pip \ + python3-setuptools \ + python3-wheel # Coral Edge TPU # https://coral.ai/docs/accelerator/get-started/#runtime-on-linux -RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list -RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - -RUN apt-get -y update -RUN apt-get -y install libedgetpu1-std +RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + apt-get -y update && apt-get -y install libedgetpu1-std # intel opencl gpu for openvino RUN if [ "$(uname -m)" = "x86_64" ]; \ @@ -31,38 +48,27 @@ RUN if [ "$(uname -m)" = "x86_64" ]; \ intel-opencl-icd; \ fi -RUN apt-get -y install software-properties-common apt-utils -RUN apt-get -y update -RUN apt-get -y upgrade - -# base development stuff -RUN apt-get -y install \ - build-essential \ - cmake \ - gcc \ - libcairo2-dev \ - libgirepository1.0-dev \ - libvips \ - pkg-config - # these are necessary for pillow-simd, additional on disk size is small # but could consider removing this. RUN apt-get -y install \ libjpeg-dev zlib1g-dev +# plugins support fallback to pillow, but vips is faster. +RUN apt-get -y install \ + libvips + # gstreamer native https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or-debian RUN apt-get -y install \ gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa \ gstreamer1.0-vaapi -# python native -RUN apt-get -y install \ - python3 \ - python3-dev \ - python3-gst-1.0 \ - python3-pip \ - python3-setuptools \ - python3-wheel +# python 3.9 from ppa. +# 3.9 is the version with prebuilt support for tensorflow lite +RUN add-apt-repository ppa:deadsnakes/ppa && \ + apt-get -y install \ + python3.9 \ + python3.9-dev \ + python3.9-distutils # armv7l does not have wheels for any of these # and compile times would forever, if it works at all. @@ -71,7 +77,7 @@ RUN apt-get -y install \ # which still reports 64bit, even if running in 32bit docker. # this scenario is not supported and will be reported at runtime. # this bit is not necessary on amd64, but leaving it for consistency. -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ +RUN apt-get -y install \ python3-matplotlib \ python3-numpy \ python3-opencv \ @@ -80,11 +86,15 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ # python pip RUN rm -f /usr/lib/python**/EXTERNALLY-MANAGED -RUN python3 -m pip install --upgrade pip -# pyvips is broken on x86 due to mismatch ffi -# https://stackoverflow.com/questions/62658237/it-seems-that-the-version-of-the-libffi-library-seen-at-runtime-is-different-fro -RUN python3 -m pip install --force-reinstall --no-binary :all: cffi -RUN python3 -m pip install debugpy typing_extensions psutil + +RUN for v in 3 3.9; \ + do \ + # pyvips is broken on x86 due to mismatch ffi + # https://stackoverflow.com/questions/62658237/it-seems-that-the-version-of-the-libffi-library-seen-at-runtime-is-different-fro + python$v -m pip install --upgrade pip && \ + python$v -m pip install --force-reinstall --no-binary :all: cffi && \ + python$v -m pip install debugpy typing_extensions psutil; \ + done ################################################################ # End section generated from template/Dockerfile.full.header diff --git a/install/docker/Dockerfile.lite b/install/docker/Dockerfile.lite index c663c6f5b..59964ce21 100644 --- a/install/docker/Dockerfile.lite +++ b/install/docker/Dockerfile.lite @@ -1,36 +1,46 @@ -ARG BASE="bullseye" +ARG BASE="jammy" FROM ubuntu:${BASE} as header -RUN apt-get update && apt-get -y install curl wget +ENV DEBIAN_FRONTEND=noninteractive -# switch to nvm? -ARG NODE_VERSION=18 -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs - -RUN apt-get -y update -RUN apt-get -y upgrade -RUN apt-get -y install software-properties-common apt-utils -RUN apt-get -y update - -# base development stuff -RUN apt-get -y install \ +# base tools and development stuff +RUN apt-get update && apt-get -y install \ + curl wget software-properties-common apt-utils \ build-essential \ cmake \ gcc \ libcairo2-dev \ libgirepository1.0-dev \ - pkg-config + pkg-config && \ + apt-get -y update && \ + apt-get -y upgrade + +ARG NODE_VERSION=18 +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get update && apt-get install -y nodejs # python native RUN apt-get -y install \ python3 \ - python3-dev \ + python3-dev\ + python3-gst-1.0 \ python3-pip \ python3-setuptools \ python3-wheel +# armv7l does not have wheels for any of these +# and compile times would forever, if it works at all. +# furthermore, it's possible to run 32bit docker on 64bit arm, +# which causes weird behavior in python which looks at the arch version +# which still reports 64bit, even if running in 32bit docker. +# this scenario is not supported and will be reported at runtime. +# this bit is not necessary on amd64, but leaving it for consistency. +RUN apt-get -y install \ + python3-matplotlib \ + python3-numpy \ + python3-opencv \ + python3-pil \ + python3-skimage + # python pip RUN rm -f /usr/lib/python**/EXTERNALLY-MANAGED RUN python3 -m pip install --upgrade pip diff --git a/install/docker/Dockerfile.nvidia b/install/docker/Dockerfile.nvidia index f27d871a6..86a318cf8 100644 --- a/install/docker/Dockerfile.nvidia +++ b/install/docker/Dockerfile.nvidia @@ -1,4 +1,4 @@ -FROM koush/18-bullseye-full.s6 +FROM koush/18-jammy-full.s6 WORKDIR / diff --git a/install/docker/Dockerfile.s6 b/install/docker/Dockerfile.s6 index 2a7c5663b..be8ff91bb 100644 --- a/install/docker/Dockerfile.s6 +++ b/install/docker/Dockerfile.s6 @@ -1,4 +1,4 @@ -ARG BASE="18-bullseye-full" +ARG BASE="18-jammy-full" FROM koush/scrypted-common:${BASE} # avahi advertiser support diff --git a/install/docker/Dockerfile.thin b/install/docker/Dockerfile.thin index 2438d2e0a..71a8d9685 100644 --- a/install/docker/Dockerfile.thin +++ b/install/docker/Dockerfile.thin @@ -1,18 +1,15 @@ -ARG BASE="bullseye" +ARG BASE="jammy" FROM ubuntu:${BASE} as header -RUN apt-get update && apt-get -y install curl wget +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && \ + apt-get -y upgrade && \ + apt-get -y install curl wget software-properties-common apt-utils # switch to nvm? ARG NODE_VERSION=18 -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs - -RUN apt-get -y update -RUN apt-get -y upgrade -RUN apt-get -y install software-properties-common apt-utils -RUN apt-get -y update +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get update && apt-get install -y nodejs ENV SCRYPTED_INSTALL_ENVIRONMENT="docker" ENV SCRYPTED_CAN_RESTART="true" diff --git a/install/docker/docker-build-nvidia.sh b/install/docker/docker-build-nvidia.sh index d3d19379a..b9094d595 100755 --- a/install/docker/docker-build-nvidia.sh +++ b/install/docker/docker-build-nvidia.sh @@ -1,3 +1,3 @@ ./docker-build.sh -docker build -t koush/scrypted:18-bullseye-full.nvidia -f Dockerfile.nvidia +docker build -t koush/scrypted:18-jammy-full.nvidia -f Dockerfile.nvidia diff --git a/install/docker/docker-build.sh b/install/docker/docker-build.sh index 7e926ca4b..2fda9861f 100755 --- a/install/docker/docker-build.sh +++ b/install/docker/docker-build.sh @@ -3,6 +3,7 @@ set -x NODE_VERSION=18 +SCRYPTED_INSTALL_VERSION=beta IMAGE_BASE=jammy FLAVOR=full BASE=$NODE_VERSION-$IMAGE_BASE-$FLAVOR @@ -14,4 +15,4 @@ docker build -t koush/scrypted-common:$BASE -f Dockerfile.$FLAVOR \ --build-arg NODE_VERSION=$NODE_VERSION --build-arg BASE=$IMAGE_BASE . && \ \ docker build -t koush/scrypted:$SUPERVISOR_BASE -f Dockerfile$SUPERVISOR \ - --build-arg BASE=$BASE . + --build-arg BASE=$BASE --build-arg SCRYPTED_INSTALL_VERSION=$SCRYPTED_INSTALL_VERSION . diff --git a/install/docker/template/Dockerfile.full.header b/install/docker/template/Dockerfile.full.header index 12839b795..e44dcc9a1 100644 --- a/install/docker/template/Dockerfile.full.header +++ b/install/docker/template/Dockerfile.full.header @@ -3,23 +3,40 @@ # This common file will be used by both Docker and the linux # install script. ################################################################ -ARG BASE="bullseye" +ARG BASE="jammy" FROM ubuntu:${BASE} as header -RUN apt-get update && apt-get -y install curl wget +ENV DEBIAN_FRONTEND=noninteractive + +# base tools and development stuff +RUN apt-get update && apt-get -y install \ + curl wget software-properties-common apt-utils \ + build-essential \ + cmake \ + gcc \ + libcairo2-dev \ + libgirepository1.0-dev \ + pkg-config && \ + apt-get -y update && \ + apt-get -y upgrade -# switch to nvm? ARG NODE_VERSION=18 -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get update && apt-get install -y nodejs + +# python native +RUN apt-get -y install \ + python3 \ + python3-dev\ + python3-gst-1.0 \ + python3-pip \ + python3-setuptools \ + python3-wheel # Coral Edge TPU # https://coral.ai/docs/accelerator/get-started/#runtime-on-linux -RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list -RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - -RUN apt-get -y update -RUN apt-get -y install libedgetpu1-std +RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + apt-get -y update && apt-get -y install libedgetpu1-std # intel opencl gpu for openvino RUN if [ "$(uname -m)" = "x86_64" ]; \ @@ -28,38 +45,27 @@ RUN if [ "$(uname -m)" = "x86_64" ]; \ intel-opencl-icd; \ fi -RUN apt-get -y install software-properties-common apt-utils -RUN apt-get -y update -RUN apt-get -y upgrade - -# base development stuff -RUN apt-get -y install \ - build-essential \ - cmake \ - gcc \ - libcairo2-dev \ - libgirepository1.0-dev \ - libvips \ - pkg-config - # these are necessary for pillow-simd, additional on disk size is small # but could consider removing this. RUN apt-get -y install \ libjpeg-dev zlib1g-dev +# plugins support fallback to pillow, but vips is faster. +RUN apt-get -y install \ + libvips + # gstreamer native https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or-debian RUN apt-get -y install \ gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa \ gstreamer1.0-vaapi -# python native -RUN apt-get -y install \ - python3 \ - python3-dev \ - python3-gst-1.0 \ - python3-pip \ - python3-setuptools \ - python3-wheel +# python 3.9 from ppa. +# 3.9 is the version with prebuilt support for tensorflow lite +RUN add-apt-repository ppa:deadsnakes/ppa && \ + apt-get -y install \ + python3.9 \ + python3.9-dev \ + python3.9-distutils # armv7l does not have wheels for any of these # and compile times would forever, if it works at all. @@ -68,7 +74,7 @@ RUN apt-get -y install \ # which still reports 64bit, even if running in 32bit docker. # this scenario is not supported and will be reported at runtime. # this bit is not necessary on amd64, but leaving it for consistency. -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ +RUN apt-get -y install \ python3-matplotlib \ python3-numpy \ python3-opencv \ @@ -77,11 +83,15 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ # python pip RUN rm -f /usr/lib/python**/EXTERNALLY-MANAGED -RUN python3 -m pip install --upgrade pip -# pyvips is broken on x86 due to mismatch ffi -# https://stackoverflow.com/questions/62658237/it-seems-that-the-version-of-the-libffi-library-seen-at-runtime-is-different-fro -RUN python3 -m pip install --force-reinstall --no-binary :all: cffi -RUN python3 -m pip install debugpy typing_extensions psutil + +RUN for v in 3 3.9; \ + do \ + # pyvips is broken on x86 due to mismatch ffi + # https://stackoverflow.com/questions/62658237/it-seems-that-the-version-of-the-libffi-library-seen-at-runtime-is-different-fro + python$v -m pip install --upgrade pip && \ + python$v -m pip install --force-reinstall --no-binary :all: cffi && \ + python$v -m pip install debugpy typing_extensions psutil; \ + done ################################################################ # End section generated from template/Dockerfile.full.header