diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index d5ede041..4cbd2c2e 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -24,15 +24,15 @@ jobs: - name: Running Bandit if: ${{ matrix.os == 'ubuntu-18.04' }} - run: python -m bandit -r ./ -f screen |& tee bandit.log + run: python -m bandit -r ./ -f screen - name: Running PEP checks if: ${{ matrix.os == 'ubuntu-18.04' }} - run: python -m flake8 ./ --config=setup.cfg --show-source |& tee flake8.log + run: python -m flake8 ./ --config=setup.cfg --show-source - name: Running MyPy checks if: ${{ matrix.os == 'ubuntu-18.04' }} - run: python -m mypy ./ --config-file ./setup.cfg --show-error-context --show-column-numbers --pretty |& tee mypy.log + run: python -m mypy ./ --config-file ./setup.cfg --show-error-context --show-column-numbers --pretty - name: Running pytest (not Docker image tests) if: ${{ always() }} @@ -44,7 +44,4 @@ jobs: with: name: codestyle_checks path: | - ./bandit.log - ./flake8.log - ./mypy.log ./utils_unittests.html \ No newline at end of file diff --git a/dockerfiles/ubuntu18/build_custom/Dockerfile b/dockerfiles/ubuntu18/build_custom/Dockerfile index 44b154b7..a6d6e3d9 100644 --- a/dockerfiles/ubuntu18/build_custom/Dockerfile +++ b/dockerfiles/ubuntu18/build_custom/Dockerfile @@ -4,20 +4,18 @@ FROM ubuntu:18.04 AS setup_openvino # hadolint ignore=DL3008 RUN apt-get update; \ + DEBIAN_FRONTEND=noninteractive \ apt-get install -y --no-install-recommends \ + tzdata \ git \ git-lfs \ sudo \ - curl \ python3-dev \ python3-pip \ python3-venv \ python3-setuptools; \ rm -rf /var/lib/apt/lists/* -# Set location -RUN ln -snf "/usr/share/zoneinfo/$(curl https://ipapi.co/timezone -k)" /etc/localtime - ARG openvino_branch="master" WORKDIR /tmp @@ -75,8 +73,9 @@ FROM copy_openvino AS openvino # hadolint ignore=DL3008 RUN apt-get update; \ + DEBIAN_FRONTEND=noninteractive \ apt-get install -y --no-install-recommends \ - curl \ + tzdata \ wget \ udev \ sudo \ @@ -86,9 +85,6 @@ RUN apt-get update; \ python3-setuptools; \ rm -rf /var/lib/apt/lists/* -# Set location -RUN ln -snf "/usr/share/zoneinfo/$(curl https://ipapi.co/timezone -k)" /etc/localtime - WORKDIR ${INTEL_OPENVINO_DIR} RUN chmod +x install_dependencies/install_openvino_dependencies.sh; \ ./install_dependencies/install_openvino_dependencies.sh diff --git a/dockerfiles/ubuntu18/build_custom/README.md b/dockerfiles/ubuntu18/build_custom/README.md index e893fb95..83fcc082 100644 --- a/dockerfiles/ubuntu18/build_custom/README.md +++ b/dockerfiles/ubuntu18/build_custom/README.md @@ -31,7 +31,7 @@ You can manually setup cmake parameters to build a custom package from source co * [openvino_cmake.txt](openvino_cmake.txt) * [opencv_cmake.txt](opencv_cmake.txt) -**Notes**: +>**Note**: By default, these files already contain some parameters. Do not override PATH/PREFIX options. This can break a build of package. @@ -65,13 +65,12 @@ docker build --target opencv -t ie:opencv . ## How to test You can use our default pipeline to test your image: ``` -python3 docker_openvino.py test -t [image:tag] -dist dev -p 2021.2 +python3 docker_openvino.py test -t [image:tag] -dist custom ``` -If Open Model Zoo is not contained in your image: -``` -python3 docker_openvino.py test -t [image:tag] -dist runtime -u [package_url] -``` +>**Note**: +Docker_ci automatically runs the corresponding tests. +By default, the product version is equal to the latest release version. Use `-p` to override this. ## How to run Please follow [Run built image](../get-started.md#run-built-image) section in DockerHub CI getting started guide. diff --git a/dockerfiles/ubuntu18/openvino_cgvh_data_dev_2021.3.dockerfile b/dockerfiles/ubuntu18/openvino_cgvh_data_dev_2021.3.dockerfile new file mode 100644 index 00000000..a786b3be --- /dev/null +++ b/dockerfiles/ubuntu18/openvino_cgvh_data_dev_2021.3.dockerfile @@ -0,0 +1,291 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:18.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:18.04 AS ov_base + +LABEL Description="This is the data_dev image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 18.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr22 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + libfluidsynth1 \ + libnettle6 \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-alsa \ + libglib2.0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.6 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# data dev package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + find "${INTEL_OPENVINO_DIR}/" -type f \( -name "*requirements.*" -o -name "*requirements_ubuntu18.*" -o \( -name "*requirements*.in" -and -not -name "*requirements-tensorflow.in" \) \) -not -path "*/accuracy_checker/*" -not -path "*/post_training_optimization_toolkit/*" -not -path "*/python3*/*" -not -path "*/python2*/*" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; + + +ENV VENV_TF2 /opt/intel/venv_tf2 + +RUN ${PYTHON_VER} -m venv ${VENV_TF2} && \ + source ${VENV_TF2}/bin/activate && \ + pip install --no-cache-dir -U pip==19.3.1 && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/model_optimizer/" -type f \( -name "*requirements*.txt" -and -not -name "*requirements_tf.txt" \) -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader/" -type f -name "*requirements*.in" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + deactivate + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker +RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/build + +# download source for pypi-kenlm LGPL package +COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/build + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem1.65-dev \ + libboost-thread1.65-dev \ + libjson-c3 libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu18/openvino_cgvh_data_runtime_2021.3.dockerfile b/dockerfiles/ubuntu18/openvino_cgvh_data_runtime_2021.3.dockerfile new file mode 100644 index 00000000..eb087752 --- /dev/null +++ b/dockerfiles/ubuntu18/openvino_cgvh_data_runtime_2021.3.dockerfile @@ -0,0 +1,267 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:18.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:18.04 AS ov_base + +LABEL Description="This is the data_runtime image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 18.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr22 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + libfluidsynth1 \ + libnettle6 \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-alsa \ + libglib2.0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.6 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# runtime package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + if [ -f ${INTEL_OPENVINO_DIR}/data_processing/dl_streamer/requirements.txt ]; then \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/data_processing/dl_streamer/requirements.txt; \ + fi + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem1.65-dev \ + libboost-thread1.65-dev \ + libjson-c3 libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu18/openvino_cgvh_dev_2021.3.dockerfile b/dockerfiles/ubuntu18/openvino_cgvh_dev_2021.3.dockerfile new file mode 100644 index 00000000..083e0505 --- /dev/null +++ b/dockerfiles/ubuntu18/openvino_cgvh_dev_2021.3.dockerfile @@ -0,0 +1,273 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:18.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:18.04 AS ov_base + +LABEL Description="This is the dev image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 18.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.6 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# dev package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + find "${INTEL_OPENVINO_DIR}/" -type f \( -name "*requirements.*" -o -name "*requirements_ubuntu18.*" -o \( -name "*requirements*.in" -and -not -name "*requirements-tensorflow.in" \) \) -not -path "*/accuracy_checker/*" -not -path "*/post_training_optimization_toolkit/*" -not -path "*/python3*/*" -not -path "*/python2*/*" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; + +ENV VENV_TF2 /opt/intel/venv_tf2 + +RUN ${PYTHON_VER} -m venv ${VENV_TF2} && \ + source ${VENV_TF2}/bin/activate && \ + pip install --no-cache-dir -U pip==19.3.1 && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/model_optimizer/" -type f \( -name "*requirements*.txt" -and -not -name "*requirements_tf.txt" \) -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader/" -type f -name "*requirements*.in" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + deactivate + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker +RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/build + +# download source for pypi-kenlm LGPL package +COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/build + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem1.65-dev \ + libboost-thread1.65-dev \ + libjson-c3 libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu18/openvino_cgvh_proprietary_2021.3.dockerfile b/dockerfiles/ubuntu18/openvino_cgvh_proprietary_2021.3.dockerfile new file mode 100644 index 00000000..37f280b8 --- /dev/null +++ b/dockerfiles/ubuntu18/openvino_cgvh_proprietary_2021.3.dockerfile @@ -0,0 +1,289 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:18.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by installation script +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends cpio && \ + rm -rf /var/lib/apt/lists/* && \ + tar -xzf ${TEMP_DIR}/*.tgz --strip 1 && \ + sed -i 's/decline/accept/g' silent.cfg && \ + ${TEMP_DIR}/install.sh -s silent.cfg && \ + OV_BUILD="$(find /opt/intel -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && rm -rf ${TEMP_DIR} && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:18.04 AS ov_base + +LABEL Description="This is the proprietary image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 18.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr22 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + libfluidsynth1 \ + libnettle6 \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-alsa \ + libglib2.0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.6 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# proprietary package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + find "${INTEL_OPENVINO_DIR}/" -type f \( -name "*requirements.*" -o -name "*requirements_ubuntu18.*" -o \( -name "*requirements*.in" -and -not -name "*requirements-tensorflow.in" \) \) -not -path "*/accuracy_checker/*" -not -path "*/post_training_optimization_toolkit/*" -not -path "*/python3*/*" -not -path "*/python2*/*" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; + +ENV VENV_TF2 /opt/intel/venv_tf2 + +RUN ${PYTHON_VER} -m venv ${VENV_TF2} && \ + source ${VENV_TF2}/bin/activate && \ + pip install --no-cache-dir -U pip==19.3.1 && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/model_optimizer/" -type f \( -name "*requirements*.txt" -and -not -name "*requirements_tf.txt" \) -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader/" -type f -name "*requirements*.in" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + deactivate + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker +RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/build + +# download source for pypi-kenlm LGPL package +COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/build + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem1.65-dev \ + libboost-thread1.65-dev \ + libjson-c3 libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu18/openvino_cgvh_runtime_2021.3.dockerfile b/dockerfiles/ubuntu18/openvino_cgvh_runtime_2021.3.dockerfile new file mode 100644 index 00000000..a5ad6d9a --- /dev/null +++ b/dockerfiles/ubuntu18/openvino_cgvh_runtime_2021.3.dockerfile @@ -0,0 +1,246 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:18.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + +RUN rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/data_processing + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:18.04 AS ov_base + +LABEL Description="This is the runtime image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 18.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl" +ARG LGPL_DEPS=libgtk-3-0 +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.6 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# runtime package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem1.65-dev \ + libboost-thread1.65-dev \ + libjson-c3 libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu20/openvino_cgvh_data_dev_2021.3.dockerfile b/dockerfiles/ubuntu20/openvino_cgvh_data_dev_2021.3.dockerfile new file mode 100644 index 00000000..a5b44fed --- /dev/null +++ b/dockerfiles/ubuntu20/openvino_cgvh_data_dev_2021.3.dockerfile @@ -0,0 +1,298 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:20.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:20.04 AS ov_base + +LABEL Description="This is the data_dev image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 20.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr24 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-alsa \ + libgstrtspserver-1.0-dev \ + python3-gst-1.0 \ + libfluidsynth2 \ + libnettle7 \ + libglib2.0-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=pot -c=opencv_opt -c=dlstreamer" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.8 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# data dev package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + find "${INTEL_OPENVINO_DIR}/" -type f \( -name "*requirements.*" -o -name "*requirements_ubuntu20.*" -o \( -name "*requirements*.in" -and -not -name "*requirements-tensorflow.in" \) \) -not -path "*/accuracy_checker/*" -not -path "*/post_training_optimization_toolkit/*" -not -path "*/python3*/*" -not -path "*/python2*/*" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; + +ENV VENV_TF2 /opt/intel/venv_tf2 + +RUN ${PYTHON_VER} -m venv ${VENV_TF2} && \ + source ${VENV_TF2}/bin/activate && \ + pip install --no-cache-dir -U pip==19.3.1 && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/model_optimizer/" -type f \( -name "*requirements*.txt" -and -not -name "*requirements_tf.txt" \) -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader/" -type f -name "*requirements*.in" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + deactivate + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker +RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/build + +# download source for pypi-kenlm LGPL package +COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz + + + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \ + ${PYTHON_VER} -m pip install . + + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libjson-c4 \ + libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev gfortran && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu20/openvino_cgvh_data_runtime_2021.3.dockerfile b/dockerfiles/ubuntu20/openvino_cgvh_data_runtime_2021.3.dockerfile new file mode 100644 index 00000000..33e06bdc --- /dev/null +++ b/dockerfiles/ubuntu20/openvino_cgvh_data_runtime_2021.3.dockerfile @@ -0,0 +1,272 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:20.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:20.04 AS ov_base + +LABEL Description="This is the data_runtime image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 20.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr24 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-alsa \ + libgstrtspserver-1.0-dev \ + python3-gst-1.0 \ + libfluidsynth2 \ + libnettle7 \ + libglib2.0-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.8 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# runtime package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + if [ -f ${INTEL_OPENVINO_DIR}/data_processing/dl_streamer/requirements.txt ]; then \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/data_processing/dl_streamer/requirements.txt; \ + fi + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libjson-c4 \ + libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev gfortran && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu20/openvino_cgvh_dev_2021.3.dockerfile b/dockerfiles/ubuntu20/openvino_cgvh_dev_2021.3.dockerfile new file mode 100644 index 00000000..f09d0a80 --- /dev/null +++ b/dockerfiles/ubuntu20/openvino_cgvh_dev_2021.3.dockerfile @@ -0,0 +1,277 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:20.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:20.04 AS ov_base + +LABEL Description="This is the dev image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 20.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=pot" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.8 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# dev package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt && \ + find "${INTEL_OPENVINO_DIR}/" -type f \( -name "*requirements.*" -o -name "*requirements_ubuntu20.*" -o \( -name "*requirements*.in" -and -not -name "*requirements-tensorflow.in" \) \) -not -path "*/accuracy_checker/*" -not -path "*/post_training_optimization_toolkit/*" -not -path "*/python3*/*" -not -path "*/python2*/*" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; + +ENV VENV_TF2 /opt/intel/venv_tf2 + +RUN ${PYTHON_VER} -m venv ${VENV_TF2} && \ + source ${VENV_TF2}/bin/activate && \ + pip install --no-cache-dir -U pip==19.3.1 && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/model_optimizer/" -type f \( -name "*requirements*.txt" -and -not -name "*requirements_tf.txt" \) -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + find "${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader/" -type f -name "*requirements*.in" -print -exec ${PYTHON_VER} -m pip install --no-cache-dir -r "{}" \; && \ + deactivate + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker +RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ + ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/requirements.in && \ + ${PYTHON_VER} ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/setup.py install && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/accuracy_checker/build + +# download source for pypi-kenlm LGPL package +COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz + + + + +WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit/requirements.txt && \ + ${PYTHON_VER} -m pip install . + + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libjson-c4 \ + libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev gfortran && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/dockerfiles/ubuntu20/openvino_cgvh_runtime_2021.3.dockerfile b/dockerfiles/ubuntu20/openvino_cgvh_runtime_2021.3.dockerfile new file mode 100644 index 00000000..eedb65a3 --- /dev/null +++ b/dockerfiles/ubuntu20/openvino_cgvh_runtime_2021.3.dockerfile @@ -0,0 +1,249 @@ +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:20.04 AS base + +# hadolint ignore=DL3002 +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# download source for pypi-kenlm LGPL package +WORKDIR /tmp +RUN curl -L https://files.pythonhosted.org/packages/7f/e6/1639d2de28c27632e3136015ecfd67774cca6f55146507baeaef06b113ba/pypi-kenlm-0.1.20190403.tar.gz --output pypi-kenlm.tar.gz + + +# get product from URL +ARG package_url +ARG TEMP_DIR=/tmp/openvino_installer + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3020 +ADD ${package_url} ${TEMP_DIR} + +# install product by copying archive content +ARG TEMP_DIR=/tmp/openvino_installer +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +RUN tar -xzf "${TEMP_DIR}"/*.tgz && \ + OV_BUILD="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+.\d+.\d+')" && \ + OV_YEAR="$(find . -maxdepth 1 -type d -name "*openvino*" | grep -oP '(?<=_)\d+')" && \ + OV_FOLDER="$(find . -maxdepth 1 -type d -name "*openvino*")" && \ + mkdir -p /opt/intel/openvino_"$OV_BUILD"/ && \ + cp -rf "$OV_FOLDER"/* /opt/intel/openvino_"$OV_BUILD"/ && \ + rm -rf "${TEMP_DIR:?}"/"$OV_FOLDER" && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino && \ + ln --symbolic /opt/intel/openvino_"$OV_BUILD"/ /opt/intel/openvino_"$OV_YEAR" && \ + rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/tools/workbench && rm -rf ${TEMP_DIR} + + +RUN rm -rf ${INTEL_OPENVINO_DIR}/deployment_tools/data_processing + + +# for GPU +ARG GMMLIB +ARG IGC_CORE +ARG IGC_OPENCL +ARG INTEL_OPENCL +ARG INTEL_OCLOC +ARG TEMP_DIR=/tmp/opencl + +WORKDIR ${TEMP_DIR} +RUN curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-gmmlib_${GMMLIB}_amd64.deb" --output "intel-gmmlib_${GMMLIB}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-core_${IGC_CORE}_amd64.deb" --output "intel-igc-core_${IGC_CORE}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-igc-opencl_${IGC_OPENCL}_amd64.deb" --output "intel-igc-opencl_${IGC_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-opencl_${INTEL_OPENCL}_amd64.deb" --output "intel-opencl_${INTEL_OPENCL}_amd64.deb" && \ + curl -L "https://github.com/intel/compute-runtime/releases/download/${INTEL_OPENCL}/intel-ocloc_${INTEL_OCLOC}_amd64.deb" --output "intel-ocloc_${INTEL_OCLOC}_amd64.deb" + + +# for VPU +ARG BUILD_DEPENDENCIES="autoconf \ + automake \ + build-essential \ + libtool \ + unzip" + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && rm -rf v1.0.22.zip + +WORKDIR /opt/libusb-1.0.22 +RUN ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 + +# ----------------- +FROM ubuntu:20.04 AS ov_base + +LABEL Description="This is the runtime image for Intel(R) Distribution of OpenVINO(TM) toolkit on Ubuntu 20.04 LTS" +LABEL Vendor="Intel Corporation" + +USER root +WORKDIR / + +SHELL ["/bin/bash", "-xo", "pipefail", "-c"] + +# Creating user openvino and adding it to groups "video" and "users" to use GPU and VPU +RUN useradd -ms /bin/bash -G video,users openvino && \ + chown openvino -R /home/openvino + +RUN mkdir /opt/intel + +ENV INTEL_OPENVINO_DIR /opt/intel/openvino + +COPY --from=base /opt/intel /opt/intel + +WORKDIR /thirdparty + +ARG INSTALL_SOURCES="yes" + + +ARG DEPS="dpkg-dev \ + tzdata \ + curl" +ARG LGPL_DEPS="g++ \ + gcc \ + libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" + + + +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + + + +# setup Python +ENV PYTHON_VER python3.8 + + + +RUN ${PYTHON_VER} -m pip install --upgrade pip + +# runtime package +WORKDIR /tmp + +RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/python/${PYTHON_VER}/requirements.txt + +# for CPU + +# for GPU +ARG TEMP_DIR=/tmp/opencl + +COPY --from=base ${TEMP_DIR} ${TEMP_DIR} + +WORKDIR ${TEMP_DIR} +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \ + rm -rf /var/lib/apt/lists/* && \ + dpkg -i ${TEMP_DIR}/*.deb && \ + ldconfig && \ + rm -rf ${TEMP_DIR} + +# for VPU +ARG LGPL_DEPS=udev + +WORKDIR /thirdparty + +# hadolint ignore=DL3008 +RUN apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > no_vpu_packages.txt && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > vpu_packages.txt && \ + grep -v -f no_vpu_packages.txt vpu_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt + +COPY --from=base /opt/libusb-1.0.22 /opt/libusb-1.0.22 + +WORKDIR /opt/libusb-1.0.22/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' + +WORKDIR /opt/libusb-1.0.22/ +RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp ${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig + +# for HDDL +WORKDIR /tmp +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libjson-c4 \ + libxxf86vm-dev && \ + rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* + + +# Post-installation cleanup and setting up OpenVINO environment variables +RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ + printf "\nexport TBB_DIR=\${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/cmake\n" >> ${INTEL_OPENVINO_DIR}/bin/setupvars.sh; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /home/openvino/.bashrc; \ + printf "\nsource \${INTEL_OPENVINO_DIR}/bin/setupvars.sh\n" >> /root/.bashrc; \ + fi; \ + if [ -d "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk ]; then \ + ln --symbolic "${INTEL_OPENVINO_DIR}"/opt/intel/mediasdk/ /opt/intel/mediasdk || true; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /home/openvino/.bashrc; \ + printf "\nexport LIBVA_DRIVER_NAME=iHD \nexport LIBVA_DRIVERS_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/ \nexport GST_VAAPI_ALL_DRIVERS=1 \nexport LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LIBRARY_PATH \nexport LD_LIBRARY_PATH=\${INTEL_OPENVINO_DIR}/opt/intel/mediasdk/lib64/:\$LD_LIBRARY_PATH \n" >> /root/.bashrc; \ + fi; + +RUN apt-get update && \ + apt-get autoremove -y dpkg-dev gfortran && \ + rm -rf /var/lib/apt/lists/* + +USER openvino +WORKDIR ${INTEL_OPENVINO_DIR} + +CMD ["/bin/bash"] + +# Setup custom layers below diff --git a/setup.cfg b/setup.cfg index c60466a3..e604dd1f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,10 +3,10 @@ max-line-length = 120 show_source = True exclude = venv, tests/resources docstring-convention = google -ignore = DAR101, DAR201, DAR401, D107, D415, I201, T001, S404, S603, G004, B009, E800 +ignore = DAR101, DAR201, DAR401, D107, D415, I201, T001, S404, S603, G004, B009, E800, S607 enable-extensions=G per-file-ignores = - tests/*: D100,D101,D102,D104 + tests/*: D100,D101,D102,D104,S108 tests/conftest.py: D100,D101,D102,D103,D104 [pydocstyle] diff --git a/templates/ubuntu18/common/base.dockerfile.j2 b/templates/ubuntu18/common/base.dockerfile.j2 index 52dbeabe..c92642c4 100644 --- a/templates/ubuntu18/common/base.dockerfile.j2 +++ b/templates/ubuntu18/common/base.dockerfile.j2 @@ -43,17 +43,27 @@ COPY --from=base /opt/intel /opt/intel WORKDIR /thirdparty +ARG INSTALL_SOURCES="yes" + {% if 'runtime' == distribution %} -ARG DEPS=dpkg-dev +ARG DEPS="dpkg-dev \ + tzdata \ + curl" ARG LGPL_DEPS=libgtk-3-0 +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" {% elif 'dev' == distribution %} -ARG DEPS=dpkg-dev +ARG DEPS="dpkg-dev \ + tzdata \ + curl" ARG LGPL_DEPS="g++ \ gcc \ libc6-dev \ libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" {% else %} ARG DEPS="dpkg-dev \ + tzdata \ + curl \ libopenexr22 \ flex" ARG LGPL_DEPS="g++ \ @@ -75,20 +85,45 @@ ARG LGPL_DEPS="g++ \ gstreamer1.0-plugins-ugly \ gstreamer1.0-alsa \ libglib2.0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" {% endif %} -ARG INSTALL_SOURCES="yes" +{% if build_id < '2021.3' %} +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* # hadolint ignore=DL3008 RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata && \ - apt-get install -y --no-install-recommends ${DEPS} && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt +{% else %} +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ rm -rf /var/lib/apt/lists/* # hadolint ignore=DL3008 RUN apt-get update && \ apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ if [ "$INSTALL_SOURCES" = "yes" ]; then \ sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ apt-get update && \ @@ -104,6 +139,7 @@ RUN apt-get update && \ done && \ echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ rm -rf /var/lib/apt/lists/* && rm -rf *.txt +{% endif %} {% for command in commands %} {{ command|safe }} diff --git a/templates/ubuntu18/python/python36.dockerfile.j2 b/templates/ubuntu18/python/python36.dockerfile.j2 index 59dceeac..d37ef04f 100644 --- a/templates/ubuntu18/python/python36.dockerfile.j2 +++ b/templates/ubuntu18/python/python36.dockerfile.j2 @@ -1,6 +1,7 @@ # setup Python ENV PYTHON_VER python3.6 +{% if build_id < '2021.3' %} {% if 'runtime' in distribution %} # hadolint ignore=DL3008 RUN apt-get update && \ @@ -12,5 +13,6 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends python3-pip python3-dev python3-venv python3-setuptools lib${PYTHON_VER} && \ rm -rf /var/lib/apt/lists/* {% endif %} +{% endif %} RUN ${PYTHON_VER} -m pip install --upgrade pip \ No newline at end of file diff --git a/templates/ubuntu20/common/base.dockerfile.j2 b/templates/ubuntu20/common/base.dockerfile.j2 index 589699b2..6f83aae6 100644 --- a/templates/ubuntu20/common/base.dockerfile.j2 +++ b/templates/ubuntu20/common/base.dockerfile.j2 @@ -43,19 +43,59 @@ COPY --from=base /opt/intel /opt/intel WORKDIR /thirdparty +ARG INSTALL_SOURCES="yes" + {% if 'runtime' == distribution %} -ARG DEPS=dpkg-dev +ARG DEPS="dpkg-dev \ + tzdata \ + curl" ARG LGPL_DEPS="g++ \ gcc \ libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python" {% elif 'dev' == distribution %} -ARG DEPS=dpkg-dev +ARG DEPS="dpkg-dev \ + tzdata \ + curl" ARG LGPL_DEPS="g++ \ gcc \ libc6-dev \ libgtk-3-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=pot" +{% elif 'data_runtime' == distribution %} +ARG DEPS="dpkg-dev \ + tzdata \ + curl \ + libopenexr24 \ + flex" +ARG LGPL_DEPS="g++ \ + gcc \ + libc6-dev \ + libgtk-3-0 \ + libgstreamer1.0-0 \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-vaapi \ + ffmpeg \ + libgl-dev \ + libtag-extras1 \ + libfaac0 \ + python3-gi \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-alsa \ + libgstrtspserver-1.0-dev \ + python3-gst-1.0 \ + libfluidsynth2 \ + libnettle7 \ + libglib2.0-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=opencv_opt -c=dlstreamer" {% else %} ARG DEPS="dpkg-dev \ + tzdata \ + curl \ libopenexr24 \ flex" ARG LGPL_DEPS="g++ \ @@ -81,20 +121,45 @@ ARG LGPL_DEPS="g++ \ libfluidsynth2 \ libnettle7 \ libglib2.0-0" +ARG INSTALL_PACKAGES="-c=opencv_req -c=python -c=pot -c=opencv_opt -c=dlstreamer" {% endif %} +{% if build_id < '2021.3' %} # hadolint ignore=DL3008 RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl tzdata && \ - apt-get install -y --no-install-recommends ${DEPS} && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ rm -rf /var/lib/apt/lists/* -ARG INSTALL_SOURCES="yes" +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + if [ "$INSTALL_SOURCES" = "yes" ]; then \ + sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > all_packages.txt && \ + grep -v -f base_packages.txt all_packages.txt | while read line; do \ + package=`echo $line`; \ + name=(${package//:/ }); \ + grep -l GPL /usr/share/doc/${name[0]}/copyright; \ + exit_status=$?; \ + if [ $exit_status -eq 0 ]; then \ + apt-get source -q --download-only $package; \ + fi \ + done && \ + echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ + rm -rf /var/lib/apt/lists/* && rm -rf *.txt +{% else %} +# hadolint ignore=DL3008 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${DEPS} && \ + dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \ + rm -rf /var/lib/apt/lists/* # hadolint ignore=DL3008 RUN apt-get update && \ apt-get install -y --no-install-recommends ${LGPL_DEPS} && \ + ${INTEL_OPENVINO_DIR}/install_dependencies/install_openvino_dependencies.sh -y ${INSTALL_PACKAGES} && \ if [ "$INSTALL_SOURCES" = "yes" ]; then \ sed -Ei 's/# deb-src /deb-src /' /etc/apt/sources.list && \ apt-get update && \ @@ -110,6 +175,7 @@ RUN apt-get update && \ done && \ echo "Download source for `ls | wc -l` third-party packages: `du -sh`"; fi && \ rm -rf /var/lib/apt/lists/* && rm -rf *.txt +{% endif %} {% for command in commands %} {{ command|safe }} @@ -128,7 +194,7 @@ RUN if [ -f "${INTEL_OPENVINO_DIR}"/bin/setupvars.sh ]; then \ fi; RUN apt-get update && \ - apt-get autoremove -y dpkg-dev && \ + apt-get autoremove -y dpkg-dev gfortran && \ rm -rf /var/lib/apt/lists/* USER openvino diff --git a/templates/ubuntu20/dist/data_dev.dockerfile.j2 b/templates/ubuntu20/dist/data_dev.dockerfile.j2 index e505b457..56de900f 100644 --- a/templates/ubuntu20/dist/data_dev.dockerfile.j2 +++ b/templates/ubuntu20/dist/data_dev.dockerfile.j2 @@ -32,10 +32,13 @@ RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ # download source for pypi-kenlm LGPL package COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz +{% if build_id < '2021.3' %} +# Installing POT PyPi build dependencies # hadolint ignore=DL3008 RUN apt-get update && \ apt-get install -y --no-install-recommends libblas-dev liblapack-dev gfortran && \ rm -rf /var/lib/apt/lists/* +{% endif %} {% if '2021.2' not in build_id %} WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit @@ -45,8 +48,4 @@ RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deploym WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit RUN ${PYTHON_VER} -m pip install --no-cache-dir scipy==1.2.1 jstyleson==0.0.2 pandas==0.24.2 hyperopt==0.1.2 addict==2.2.1 chainer==7.7.0 && \ ${PYTHON_VER} -m pip install . --no-deps -{% endif %} - -RUN apt-get update && \ - apt-get autoremove -y gfortran && \ - rm -rf /var/lib/apt/lists/* \ No newline at end of file +{% endif %} \ No newline at end of file diff --git a/templates/ubuntu20/dist/dev.dockerfile.j2 b/templates/ubuntu20/dist/dev.dockerfile.j2 index 749f5f9e..0a9aa6af 100644 --- a/templates/ubuntu20/dist/dev.dockerfile.j2 +++ b/templates/ubuntu20/dist/dev.dockerfile.j2 @@ -32,10 +32,13 @@ RUN source ${INTEL_OPENVINO_DIR}/bin/setupvars.sh && \ # download source for pypi-kenlm LGPL package COPY --from=base /tmp/pypi-kenlm.tar.gz /thirdparty/pypi-kenlm.tar.gz +{% if build_id < '2021.3' %} +# Installing POT PyPi build dependencies # hadolint ignore=DL3008 RUN apt-get update && \ apt-get install -y --no-install-recommends libblas-dev liblapack-dev gfortran && \ rm -rf /var/lib/apt/lists/* +{% endif %} {% if '2021.2' not in build_id %} WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit @@ -45,8 +48,4 @@ RUN ${PYTHON_VER} -m pip install --no-cache-dir -r ${INTEL_OPENVINO_DIR}/deploym WORKDIR ${INTEL_OPENVINO_DIR}/deployment_tools/tools/post_training_optimization_toolkit RUN ${PYTHON_VER} -m pip install --no-cache-dir scipy==1.2.1 jstyleson==0.0.2 pandas==0.24.2 hyperopt==0.1.2 addict==2.2.1 chainer==7.7.0 && \ ${PYTHON_VER} -m pip install . --no-deps -{% endif %} - -RUN apt-get update && \ - apt-get autoremove -y gfortran && \ - rm -rf /var/lib/apt/lists/* \ No newline at end of file +{% endif %} \ No newline at end of file diff --git a/templates/ubuntu20/python/python38.dockerfile.j2 b/templates/ubuntu20/python/python38.dockerfile.j2 index 264a4176..3f74295d 100644 --- a/templates/ubuntu20/python/python38.dockerfile.j2 +++ b/templates/ubuntu20/python/python38.dockerfile.j2 @@ -1,6 +1,7 @@ # setup Python ENV PYTHON_VER python3.8 +{% if build_id < '2021.3' %} {% if 'runtime' in distribution %} # hadolint ignore=DL3008 RUN apt-get update && \ @@ -12,5 +13,6 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends python3-pip python3-dev python3-venv python3-setuptools lib${PYTHON_VER} && \ rm -rf /var/lib/apt/lists/* {% endif %} +{% endif %} RUN ${PYTHON_VER} -m pip install --upgrade pip \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 469f849a..a408878b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,7 +38,7 @@ def pytest_configure(config): 'markers', 'gpu: run tests on GPU device', ) dist = config.getoption('--distribution') - if dist.endswith('runtime'): + if dist in ('data_runtime', 'runtime', 'custom-no-omz', 'custom-no-cv'): log.info('Setting up runtime image dependencies') mount_root = pathlib.Path(config.getoption('--mount_root')) package_url = config.getoption('--package_url') @@ -166,54 +166,26 @@ def switch_container_engine(engine): @pytest.fixture(scope='session') def _is_distribution(request): - settings = [] - if isinstance(request.param, str): - settings.append(request.param) - else: - settings = request.param + settings = [request.param] if isinstance(request.param, str) else request.param image_dist = request.config.getoption('--distribution') - if not any(map(lambda x: x in image_dist, settings)): - pytest.skip(f'Test requires the product distribution should be {request.param} but get ' - f'{image_dist}') + if image_dist not in settings: + pytest.skip(f'Test requires the product distribution should be {request.param} but get {image_dist}') @pytest.fixture(scope='session') -def _is_image_os(request): - settings = [] - if isinstance(request.param, str): - settings.append(request.param) - else: - settings = request.param - image_os = request.config.getoption('--image_os') - if not any(map(lambda x: x in image_os, settings)): - pytest.skip(f'Test requires the image os should be {request.param} but get ' - f'{image_os}') - - -@pytest.fixture(scope='session') -def _is_image(request): - settings = [] - if isinstance(request.param, str): - settings.append(request.param) - else: - settings = request.param - image_name = request.config.getoption('--image') - if not any(map(lambda x: x in image_name, settings)): - pytest.skip(f'Test requires the image should be {request.param} but get ' - f'{image_name}') +def _is_not_distribution(request): + settings = [request.param] if isinstance(request.param, str) else request.param + image_dist = request.config.getoption('--distribution') + if image_dist in settings: + pytest.skip(f'Test requires the product distribution should not be {request.param} but get {image_dist}') @pytest.fixture(scope='session') -def _is_not_image(request): - settings = [] - if isinstance(request.param, str): - settings.append(request.param) - else: - settings = request.param - image_name = request.config.getoption('--image') - if any(map(lambda x: x in image_name, settings)): - pytest.skip(f'Test requires the image should not be {request.param} but get ' - f'{image_name}') +def _is_image_os(request): + settings = [request.param] if isinstance(request.param, str) else request.param + image_os = request.config.getoption('--image_os') + if image_os not in settings: + pytest.skip(f'Test requires the image os should be {request.param} but get {image_os}') @pytest.fixture(scope='session') diff --git a/tests/functional/demos/test_demos_linux.py b/tests/functional/demos/test_demos_linux.py index b5a8663a..a5f45225 100644 --- a/tests/functional/demos/test_demos_linux.py +++ b/tests/functional/demos/test_demos_linux.py @@ -5,8 +5,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['dev', 'proprietary'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('dev', 'proprietary', 'custom-full')], indirect=True) class TestDemosLinux: def test_security_cpu(self, tester, image): tester.test_docker_image( diff --git a/tests/functional/demos/test_demos_linux_runtime.py b/tests/functional/demos/test_demos_linux_runtime.py index 2f794665..e3cde1c5 100644 --- a/tests/functional/demos/test_demos_linux_runtime.py +++ b/tests/functional/demos/test_demos_linux_runtime.py @@ -1,16 +1,14 @@ # -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import pathlib - import pytest @pytest.mark.usefixtures('_is_image_os', '_is_distribution', '_is_package_url_specified') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['data_runtime'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20', 'centos7')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('data_runtime', 'custom-no-omz', 'custom-no-cv')], indirect=True) class TestDemosLinuxDataRuntime: - def test_detection_ssd_python_cpu(self, tester, image, dev_root, sample_name): + def test_detection_ssd_python_cpu(self, tester, image, distribution, dev_root, sample_name): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -25,7 +23,7 @@ def test_detection_ssd_python_cpu(self, tester, image, dev_root, sample_name): tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name vehicle-detection-adas-0002 --precision FP16"', @@ -38,7 +36,7 @@ def test_detection_ssd_python_cpu(self, tester, image, dev_root, sample_name): ) @pytest.mark.gpu - def test_detection_ssd_python_gpu(self, tester, image, dev_root, sample_name): + def test_detection_ssd_python_gpu(self, tester, image, distribution, dev_root, sample_name): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -54,7 +52,7 @@ def test_detection_ssd_python_gpu(self, tester, image, dev_root, sample_name): tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name vehicle-detection-adas-0002 --precision FP16"', @@ -67,7 +65,7 @@ def test_detection_ssd_python_gpu(self, tester, image, dev_root, sample_name): ) @pytest.mark.vpu - def test_detection_ssd_python_vpu(self, tester, image, dev_root, sample_name): + def test_detection_ssd_python_vpu(self, tester, image, distribution, dev_root, sample_name): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -86,7 +84,7 @@ def test_detection_ssd_python_vpu(self, tester, image, dev_root, sample_name): tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name vehicle-detection-adas-0002 --precision FP16"', @@ -99,7 +97,7 @@ def test_detection_ssd_python_vpu(self, tester, image, dev_root, sample_name): ) @pytest.mark.hddl - def test_detection_ssd_python_hddl(self, tester, image, dev_root, sample_name): + def test_detection_ssd_python_hddl(self, tester, image, distribution, dev_root, sample_name): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -116,7 +114,7 @@ def test_detection_ssd_python_hddl(self, tester, image, dev_root, sample_name): tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name vehicle-detection-adas-0002 --precision FP16"', @@ -130,10 +128,10 @@ def test_detection_ssd_python_hddl(self, tester, image, dev_root, sample_name): @pytest.mark.usefixtures('_is_image_os', '_is_distribution', '_is_package_url_specified') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20', 'centos7')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('runtime', 'custom-no-omz', 'custom-no-cv')], indirect=True) class TestDemosLinuxRuntime: - def test_segmentation_python_cpu(self, tester, image, dev_root): + def test_segmentation_python_cpu(self, tester, image, distribution, dev_root): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -149,7 +147,7 @@ def test_segmentation_python_cpu(self, tester, image, dev_root): image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' 'python3 -m pip install setuptools && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name semantic-segmentation-adas-0001 --precision FP16"', @@ -163,7 +161,7 @@ def test_segmentation_python_cpu(self, tester, image, dev_root): ) @pytest.mark.gpu - def test_segmentation_python_gpu(self, tester, image, dev_root): + def test_segmentation_python_gpu(self, tester, image, distribution, dev_root): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -180,7 +178,7 @@ def test_segmentation_python_gpu(self, tester, image, dev_root): image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' 'python3 -m pip install setuptools && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name semantic-segmentation-adas-0001 --precision FP16"', @@ -194,7 +192,7 @@ def test_segmentation_python_gpu(self, tester, image, dev_root): ) @pytest.mark.vpu - def test_segmentation_python_vpu(self, tester, image, dev_root): + def test_segmentation_python_vpu(self, tester, image, distribution, dev_root): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -214,7 +212,7 @@ def test_segmentation_python_vpu(self, tester, image, dev_root): image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' 'python3 -m pip install setuptools && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name semantic-segmentation-adas-0001 --precision FP16"', @@ -229,7 +227,7 @@ def test_segmentation_python_vpu(self, tester, image, dev_root): @pytest.mark.hddl @pytest.mark.xfail(reason='38557 issue') - def test_segmentation_python_hddl(self, tester, image, dev_root): + def test_segmentation_python_hddl(self, tester, image, distribution, dev_root): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -247,7 +245,7 @@ def test_segmentation_python_hddl(self, tester, image, dev_root): image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' 'python3 -m pip install setuptools && ' - 'python3 -m pip install --no-cache-dir -r ' + f'python3 -m pip install --no-cache-dir {"opencv-python" if distribution == "custom-no-cv" else ""} -r ' '/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/requirements.in && ' 'python3 /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py ' '--name semantic-segmentation-adas-0001 --precision FP16"', diff --git a/tests/functional/demos/test_demos_windows.py b/tests/functional/demos/test_demos_windows.py index ab03b6a2..41a140d8 100644 --- a/tests/functional/demos/test_demos_windows.py +++ b/tests/functional/demos/test_demos_windows.py @@ -5,8 +5,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['winserver2019'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['dev', 'proprietary'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('winserver2019')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('dev', 'proprietary')], indirect=True) class TestDemosWindows: def test_security_cpu(self, tester, image): kwargs = {'user': 'ContainerAdministrator'} diff --git a/tests/functional/samples/test_samples_linux.py b/tests/functional/samples/test_samples_linux.py index 76e0d21b..9bdaad72 100644 --- a/tests/functional/samples/test_samples_linux.py +++ b/tests/functional/samples/test_samples_linux.py @@ -7,8 +7,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['dev', 'proprietary'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('dev', 'proprietary', 'custom-full')], indirect=True) class TestSamplesLinux: def test_hello_classification_cpp_cpu(self, tester, image): tester.test_docker_image( diff --git a/tests/functional/samples/test_samples_linux_runtime.py b/tests/functional/samples/test_samples_linux_runtime.py index 11aa0c09..a32f06b1 100644 --- a/tests/functional/samples/test_samples_linux_runtime.py +++ b/tests/functional/samples/test_samples_linux_runtime.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import pathlib - import pytest from utils.exceptions import FailedTest @@ -16,8 +14,8 @@ def install_build_essential(image_os): @pytest.mark.usefixtures('_is_image_os', '_is_distribution', '_is_package_url_specified') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7', 'centos8'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20', 'centos7', 'centos8')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('runtime', 'custom-no-omz')], indirect=True) class TestSamplesLinuxRuntime: def test_hello_classification_cpp_cpu(self, tester, image, dev_root, image_os): kwargs = { diff --git a/tests/functional/samples/test_samples_windows.py b/tests/functional/samples/test_samples_windows.py index 77cbfc02..ac60a128 100644 --- a/tests/functional/samples/test_samples_windows.py +++ b/tests/functional/samples/test_samples_windows.py @@ -7,8 +7,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['winserver2019'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['dev', 'proprietary'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('winserver2019')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('dev', 'proprietary')], indirect=True) class TestSamplesWindows: def test_hello_classification_cpp_cpu(self, tester, image): kwargs = {'user': 'ContainerAdministrator'} diff --git a/tests/functional/test_base_cpu.py b/tests/functional/test_base_cpu.py index 820ed342..dfc46671 100644 --- a/tests/functional/test_base_cpu.py +++ b/tests/functional/test_base_cpu.py @@ -8,8 +8,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['base'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('base', 'custom-no-cv')], indirect=True) def test_base_cpp(tester, image): root = pathlib.Path(os.path.realpath(__name__)).parent kwargs = { @@ -20,8 +20,6 @@ def test_base_cpp(tester, image): } tester.test_docker_image( image, - ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' - '. /opt/intel/openvino/base_cpu/demo.sh"', - ], + ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && . /opt/intel/openvino/base_cpu/demo.sh"'], test_base_cpp.__name__, **kwargs, ) diff --git a/tests/functional/test_dl_streamer.py b/tests/functional/test_dl_streamer.py index df62eab3..ab28039e 100644 --- a/tests/functional/test_dl_streamer.py +++ b/tests/functional/test_dl_streamer.py @@ -5,8 +5,8 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['data_dev', 'proprietary'], indirect=True) +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20')], indirect=True) +@pytest.mark.parametrize('_is_distribution', [('data_dev', 'proprietary')], indirect=True) class TestDLStreamerLinux: def test_draw_face_attributes_cpp_cpu(self, tester, image): kwargs = {'mem_limit': '3g'} diff --git a/tests/functional/test_pypi_deps.py b/tests/functional/test_pypi_deps.py new file mode 100644 index 00000000..cf8c9e5d --- /dev/null +++ b/tests/functional/test_pypi_deps.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2019-2020 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +import os +import pathlib + +import pytest + + +class TestPyPiDependencies: + @pytest.mark.usefixtures('_is_image_os') + @pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7', 'centos8'], indirect=True) + @pytest.mark.xfail(reason='47558 GPL Unidecode PyPi package as dependency for OMZ text_to_speech_demo') + def test_gpl_pypi_deps(self, tester, image): + root = pathlib.Path(os.path.realpath(__name__)).parent + image_folder = image.replace('/', '_').replace(':', '_') + pypi_log_folder = root / 'logs' / image_folder / 'pypi_deps' + if not pypi_log_folder.exists(): + pypi_log_folder.mkdir() + kwargs = { + 'volumes': { + root / 'tests' / 'resources' / 'pypi_deps': {'bind': '/tmp/pypi_deps', 'mode': 'rw'}, # nosec + pypi_log_folder: {'bind': '/tmp/logs', 'mode': 'rw'}, # nosec + }, + } + tester.test_docker_image( + image, + ['/bin/bash -ac "python3 -m pip freeze 2>&1 | tee /tmp/logs/pypi_deps.log"', + '/bin/bash -ac "python3 -m pip check 2>&1 | tee /tmp/logs/pypi_deps_check.log"', + 'python3 -m pip install pipdeptree', + '/bin/bash -ac "python3 -m pipdeptree -e PyGObject 2>&1 | tee /tmp/logs/pypi_deps_tree.log"', + 'python3 -m pip install pip-licenses', + 'pip-licenses --output-file /tmp/logs/pypi_licenses.log', + 'pip-licenses -f json --output-file /tmp/logs/pypi_licenses.json', + 'python3 /tmp/pypi_deps/get_gpl_packages.py -f /tmp/logs/pypi_licenses.json ' + '-l /tmp/logs/pypi_licenses_gpl.json', + ], + self.test_gpl_pypi_deps.__name__, **kwargs, + ) + + @pytest.mark.usefixtures('_is_image_os', '_is_distribution') + @pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7', 'centos8'], indirect=True) + @pytest.mark.parametrize('_is_distribution', ['dev', 'proprietary'], indirect=True) + def test_gpl_pypi_deps_venv_tf2(self, tester, image): + root = pathlib.Path(os.path.realpath(__name__)).parent + image_folder = image.replace('/', '_').replace(':', '_') + pypi_log_folder = root / 'logs' / image_folder / 'pypi_deps' + if not pypi_log_folder.exists(): + pypi_log_folder.mkdir() + kwargs = { + 'volumes': { + root / 'tests' / 'resources' / 'pypi_deps': {'bind': '/tmp/pypi_deps', 'mode': 'rw'}, # nosec + pypi_log_folder: {'bind': '/tmp/logs', 'mode': 'rw'}, # nosec + }, + } + tester.test_docker_image( + image, + ['/bin/bash -ac "cd /opt/intel/venv_tf2 && . ./bin/activate && ' + 'python3 -m pip freeze 2>&1 | tee /tmp/logs/pypi_deps_tf2.log"', + '/bin/bash -ac "cd /opt/intel/venv_tf2 && . ./bin/activate && ' + 'python3 -m pip check 2>&1 | tee /tmp/logs/pypi_deps_check_tf2.log"', + '/bin/bash -ac "cd /opt/intel/venv_tf2 && . ./bin/activate && python3 -m pip install pipdeptree && ' + 'python3 -m pipdeptree -e PyGObject 2>&1 | tee /tmp/logs/pypi_deps_tree_tf2.log"', + '/bin/bash -ac "cd /opt/intel/venv_tf2 && . ./bin/activate && python3 -m pip install pip-licenses && ' + 'pip-licenses --output-file /tmp/logs/pypi_licenses_tf2.log && ' + 'pip-licenses -f json --output-file /tmp/logs/pypi_licenses_tf2.json"', + 'python3 /tmp/pypi_deps/get_gpl_packages.py -f /tmp/logs/pypi_licenses_tf2.json ' + '-l /tmp/logs/pypi_licenses_gpl_tf2.json', + ], + self.test_gpl_pypi_deps_venv_tf2.__name__, **kwargs, + ) diff --git a/tests/functional/test_python_bindings.py b/tests/functional/test_python_bindings.py index 0369a051..efedd8b8 100644 --- a/tests/functional/test_python_bindings.py +++ b/tests/functional/test_python_bindings.py @@ -6,19 +6,20 @@ import pytest +root = pathlib.Path(os.path.realpath(__name__)).parent +kwargs = { + 'mem_limit': '3g', + 'volumes': { + root / 'tests' / 'resources' / 'python_bindings': {'bind': '/opt/intel/openvino/python_bindings'}, + }, +} -@pytest.mark.usefixtures('_is_image_os', '_is_distribution') -@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) + +@pytest.mark.usefixtures('_is_image_os', '_is_not_distribution') +@pytest.mark.parametrize('_is_image_os', [('ubuntu18', 'ubuntu20', 'centos7')], indirect=True) class TestPythonBindings: + @pytest.mark.parametrize('_is_not_distribution', [('base', 'custom-no-cv')], indirect=True) def test_opencv_bindings(self, tester, image): - root = pathlib.Path(os.path.realpath(__name__)).parent - kwargs = { - 'mem_limit': '3g', - 'volumes': { - root / 'tests' / 'resources' / 'python_bindings': {'bind': '/opt/intel/openvino/python_bindings'}, - }, - } tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' @@ -28,14 +29,8 @@ def test_opencv_bindings(self, tester, image): self.test_opencv_bindings.__name__, **kwargs, ) + @pytest.mark.parametrize('_is_not_distribution', [('base')], indirect=True) def test_openvino_bindings(self, tester, image): - root = pathlib.Path(os.path.realpath(__name__)).parent - kwargs = { - 'mem_limit': '3g', - 'volumes': { - root / 'tests' / 'resources' / 'python_bindings': {'bind': '/opt/intel/openvino/python_bindings'}, - }, - } tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' @@ -47,14 +42,8 @@ def test_openvino_bindings(self, tester, image): @pytest.mark.usefixtures('_min_product_version') @pytest.mark.parametrize('_min_product_version', ['2021.1'], indirect=True) + @pytest.mark.parametrize('_is_not_distribution', [('base')], indirect=True) def test_ngraph_bindings(self, tester, image): - root = pathlib.Path(os.path.realpath(__name__)).parent - kwargs = { - 'mem_limit': '3g', - 'volumes': { - root / 'tests' / 'resources' / 'python_bindings': {'bind': '/opt/intel/openvino/python_bindings'}, - }, - } tester.test_docker_image( image, ['/bin/bash -ac ". /opt/intel/openvino/bin/setupvars.sh && ' diff --git a/tests/resources/pypi_deps/get_gpl_packages.py b/tests/resources/pypi_deps/get_gpl_packages.py new file mode 100644 index 00000000..19b194ca --- /dev/null +++ b/tests/resources/pypi_deps/get_gpl_packages.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2019-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +"""Check GPL/LGPL license for the installed PyPi packages +""" +import argparse +import json +import logging +import sys + +parser = argparse.ArgumentParser(description='This is GPl/LGPL licenses checker for PyPi packages') +parser.add_argument( + '-f', + '--file', + metavar='PATH', + required=True, + help='JSON file with packages meta', +) +parser.add_argument( + '-l', + '--logs', + metavar='PATH', + required=False, + default='pypi_licenses_gpl.json', + help='Log file in json format', +) + +logging.basicConfig(level='INFO') +log = logging.getLogger(__name__) +log.info('Start searching GPl/LGPL licenses in the installed PyPi packages ...') +args = parser.parse_args() +with open(args.file) as licenses_file: + pkg_licenses = json.load(licenses_file) + +exit_code = 0 +gpl_pkgs = [] +for pkg in pkg_licenses: + if 'GPL' in pkg['License']: + gpl_pkgs.append(pkg) + if 'LGPL' not in pkg['License']: + log.error(f'GPL package was found in PyPi environment: {pkg}') + exit_code = 1 +log.debug(f'Found GPL/LGPL packages: {gpl_pkgs}') +with open(args.logs, 'w') as gpl_licenses_file: + json.dump(gpl_pkgs, gpl_licenses_file) +log.info(f'See GPL/LGPL licenses in the json log: {args.logs}') + +if exit_code != 0: + log.info('FAILED') +else: + log.info('PASSED') + +sys.exit(exit_code) diff --git a/utils/arg_parser.py b/utils/arg_parser.py index db7f8944..b1e3efeb 100644 --- a/utils/arg_parser.py +++ b/utils/arg_parser.py @@ -6,6 +6,7 @@ import contextlib import pathlib import re +import subprocess # nosec import sys import typing @@ -191,7 +192,7 @@ def add_dist_args(parser: argparse.ArgumentParser): parser.add_argument( '-dist', '--distribution', - choices=['base', 'runtime', 'data_runtime', 'dev', 'data_dev', 'internal_dev', 'proprietary'], + choices=['base', 'runtime', 'data_runtime', 'dev', 'data_dev', 'internal_dev', 'proprietary', 'custom'], required=' test' in parser.prog, help='Distribution type: dev, data_dev, runtime, data_runtime, internal_dev, ' 'proprietary (product pkg with an installer) or ' @@ -322,6 +323,9 @@ def parse_args(name: str, description: str): # noqa parser.error('Options --tags and --distribution are mandatory. Image operation system is "ubuntu18"' ' by default.') + if args.mode != 'test' and args.distribution == 'custom': + parser.error('Only the test mode is available for the custom distribution.') + if args.mode == 'test' and 'runtime' in args.distribution and not args.package_url: print('\nYou can run samples/demos on runtime docker image. ' 'Please provide --package_url key with path to dev distribution package in ' @@ -460,8 +464,23 @@ def parse_args(name: str, description: str): # noqa if match: # save product version YYYY.U args.product_version = match.group(1) + elif args.distribution == 'custom': + args.product_version = list(INTEL_OPENVINO_VERSION.keys())[-1] else: parser.error('Cannot get product_version from the package URL and docker image. ' 'Please specify --product_version directly.') + if args.distribution == 'custom' and not args.package_url: + args.package_url = INTEL_OPENVINO_VERSION[args.product_version][args.os]['dev'] + + if args.distribution == 'custom': + if subprocess.call(['docker', 'run', '--rm', args.tags[0], 'ls', 'opencv'], # nosec + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) != 0: + args.distribution = 'custom-no-cv' + elif subprocess.call(['docker', 'run', '--rm', args.tags[0], 'ls', 'deployment_tools/open_model_zoo'], # nosec + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) != 0: + args.distribution = 'custom-no-omz' + else: + args.distribution = 'custom-full' + return args diff --git a/utils/tests/test_arg_parser.py b/utils/tests/test_arg_parser.py index 3280ef7a..49306793 100644 --- a/utils/tests/test_arg_parser.py +++ b/utils/tests/test_arg_parser.py @@ -8,6 +8,7 @@ import pytest from utils.arg_parser import parse_args +from utils.loader import INTEL_OPENVINO_VERSION default_args = { 'build_arg': [], @@ -201,6 +202,19 @@ }, id='Successful deploy', ), + pytest.param( + { + 'mode': 'test', + 'tags': ['custom:no-cv'], + 'distribution': 'custom', + }, + { + 'distribution': 'custom-no-cv', + 'product_version': list(INTEL_OPENVINO_VERSION.keys())[-1], + 'package_url': INTEL_OPENVINO_VERSION[list(INTEL_OPENVINO_VERSION.keys())[-1]]['ubuntu18']['dev'], + }, + id='Successful test custom image', + ), ]) @mock.patch('utils.arg_parser.DockerCIArgumentParser.parse_args') @@ -354,6 +368,15 @@ def test_arg_parser_success(mock_exists, mock_parser, args, res): 'Option --registry is mandatory for this mode.', id='All without --registry', ), + pytest.param( + { + 'mode': 'build', + 'tags': ['custom:no-cv'], + 'distribution': 'custom', + }, + 'Only the test mode is available for the custom distribution.', + id='Use custom image in not test mode', + ), ]) @mock.patch('utils.arg_parser.DockerCIArgumentParser.parse_args') def test_arg_parser_error(mock_parser, args, capsys, parser_out):