forked from openvinotoolkit/model_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ubuntu based docker images (openvinotoolkit#736)
* remove move from return statements * initial ubuntu build * further adjustments * added release and nginx dockerfiles * define shell in builder dockerfile * update TF, TFS and bazel versions * upgrade bazel in centos and redhat dockerfiles * install numpy for centos and rhel * Add redhat xz package. * symlinks for libgna lib * move xz install to builder docker image * Code review. * Remove compile log. Co-authored-by: Dariusz Trawinski <[email protected]> Co-authored-by: rasapala <[email protected]>
- Loading branch information
1 parent
0f908c9
commit 4930102
Showing
22 changed files
with
405 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
# | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG BASE_IMAGE=ubuntu:20.04 | ||
FROM $BASE_IMAGE as base_build | ||
|
||
LABEL version="1.0.0" | ||
|
||
ARG PROJECT_NAME="OpenVINO Model Server 2021.4" | ||
|
||
LABEL description=${PROJECT_NAME} | ||
|
||
ARG ov_source_branch=master | ||
ARG ovms_metadata_file | ||
ARG ov_use_binary=1 | ||
ARG DLDT_PACKAGE_URL | ||
ARG OPENVINO_NAME=${DLDT_PACKAGE_URL} | ||
ARG INSTALL_DIR=/opt/intel/openvino | ||
ARG TEMP_DIR=/tmp/openvino_installer | ||
ARG DL_INSTALL_DIR=/opt/intel/openvino/deployment_tools | ||
ARG DL_DIR=/tmp | ||
ARG JOBS | ||
ARG APT_OV_PACKAGE=intel-openvino-runtime-ubuntu20-2021.4.582 | ||
# build_type=[ opt, dbg ] | ||
ARG build_type=dbg | ||
ARG debug_bazel_flags=--strip=never\ --copt="-g"\ -c\ dbg | ||
ENV HDDL_INSTALL_DIR=/opt/intel/openvino/deployment_tools/inference_engine/external/hddl | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
SHELL ["/bin/bash", "-c"] | ||
RUN apt update && apt install -y \ | ||
libboost-atomic1.67.0 \ | ||
libboost-chrono1.67.0 \ | ||
libboost-filesystem1.67.0 \ | ||
libboost-program-options1.67.0 \ | ||
libboost-thread1.67.0 \ | ||
libboost-system1.67.0 \ | ||
libboost-date-time1.67.0 \ | ||
build-essential \ | ||
cmake \ | ||
automake \ | ||
autoconf \ | ||
curl \ | ||
gdb \ | ||
git \ | ||
libusb-dev \ | ||
libcurl4-openssl-dev \ | ||
libtool \ | ||
libxml2-dev \ | ||
libnuma-dev \ | ||
patch \ | ||
pkg-config \ | ||
python2 \ | ||
python2-dev \ | ||
python-setuptools \ | ||
python3 \ | ||
python3-pip \ | ||
python3-dev \ | ||
python3-setuptools \ | ||
python3-virtualenv \ | ||
python3-numpy \ | ||
python-is-python3 \ | ||
unzip \ | ||
wget \ | ||
unzip \ | ||
xz-utils && \ | ||
apt clean | ||
|
||
|
||
# Set up Bazel | ||
ENV BAZEL_VERSION 3.7.2 | ||
WORKDIR /bazel | ||
RUN curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ | ||
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \ | ||
chmod +x bazel-*.sh && \ | ||
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ | ||
cd / && \ | ||
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh | ||
|
||
################### BUILD OPENVINO FROM SOURCE - buildarg ov_use_binary=0 ############################ | ||
# Build OpenVINO and nGraph (OV dependency) with D_GLIBCXX_USE_CXX11_ABI=0 or 1 | ||
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; git clone https://github.com/openvinotoolkit/openvino /openvino ; cd /openvino ; git checkout $ov_source_branch; git submodule update --init --recursive | ||
WORKDIR /openvino/build | ||
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cmake3 -DCMAKE_BUILD_TYPE=Release -DENABLE_SAMPLES=0 -DNGRAPH_USE_CXX_ABI=1 -DCMAKE_CXX_FLAGS=" -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-error=parentheses " .. | ||
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make --jobs=$JOBS | ||
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; mkdir -p /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/ && \ | ||
mkdir -p /opt/intel/openvino/deployment_tools/inference_engine && \ | ||
ln -s /openvino/bin/intel64/Release/lib/* /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/ && \ | ||
ln -s /openvino/inference-engine/include/ /opt/intel/openvino/deployment_tools/inference_engine/ | ||
################## END OF OPENVINO SOURCE BUILD ###################### | ||
|
||
################### TAKE OPENVINO FROM A BINARY RELEASE - buildarg ov_use_binary=1 (DEFAULT) ########## | ||
WORKDIR / | ||
# OV toolkit package | ||
RUN apt install -y cpio | ||
RUN if [ "$ov_use_binary" = "1" ] && [ "$DLDT_PACKAGE_URL" != "" ]; then true ; else exit 0 ; fi ; mkdir -p $TEMP_DIR && cd $TEMP_DIR/ && \ | ||
wget $DLDT_PACKAGE_URL && \ | ||
tar -zxf l_openvino_toolkit*.tgz && \ | ||
cd l_openvino_toolkit*/ && \ | ||
sed -i 's/decline/accept/g' silent.cfg && \ | ||
./install.sh -s silent.cfg --ignore-signature && \ | ||
rm -Rf $TEMP_DIR $INSTALL_DIR/uninstall* /tmp/* $DL_INSTALL_DIR/documentation $DL_INSTALL_DIR/inference_engine/samples | ||
|
||
# apt package | ||
RUN if [ "$ov_use_binary" = "1" ] && [ "$DLDT_PACKAGE_URL" = "" ] ; then true ; else exit 0 ; fi ; \ | ||
echo "installing apt package" && \ | ||
wget https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ | ||
apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ | ||
echo "deb https://apt.repos.intel.com/openvino/2021 all main" | tee /etc/apt/sources.list.d/intel-openvino-2021.list && \ | ||
apt update && \ | ||
apt install -y $APT_OV_PACKAGE | ||
|
||
RUN if [ "$ov_use_binary" = "1" ] ; then true ; else exit 0 ; fi ; \ | ||
ln -s /opt/intel/openvino_2021 /opt/intel/openvino | ||
|
||
# install sample apps including benchmark_app | ||
RUN if [ -f /opt/intel/openvino/deployment_tools/inference_engine/samples/cpp/build_samples.sh ]; then /opt/intel/openvino/deployment_tools/inference_engine/samples/cpp/build_samples.sh ; fi | ||
#################### END OF OPENVINO BINARY INSTALL | ||
|
||
# Build OpenVINO Model Server | ||
WORKDIR /ovms | ||
COPY .bazelrc WORKSPACE /ovms/ | ||
COPY external /ovms/external/ | ||
COPY third_party /ovms/third_party/ | ||
|
||
ENV BAZEL_LINKLIBS=-l%:libstdc++.a | ||
RUN apt install -y python-is-python3 | ||
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @org_tensorflow//tensorflow/core:framework | ||
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @tensorflow_serving//tensorflow_serving/apis:prediction_service_cc_proto | ||
|
||
####### Azure SDK needs new boost: | ||
WORKDIR /boost | ||
RUN wget https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz && \ | ||
tar xvf boost_1_68_0.tar.gz && cd boost_1_68_0 && ./bootstrap.sh && \ | ||
./b2 cxxstd=17 link=static cxxflags='-fPIC' cflags='-fPIC' \ | ||
--with-chrono --with-date_time --with-filesystem --with-program_options --with-system \ | ||
--with-random --with-thread --with-atomic --with-regex \ | ||
--with-log --with-locale \ | ||
install | ||
|
||
# OPENSSL | ||
WORKDIR /openssl | ||
|
||
RUN git clone https://github.com/openssl/openssl && cd openssl && git checkout tags/OpenSSL_1_1_1k | ||
RUN cd openssl && ./config --prefix=/usr/local/ssl --openssldir=/etc/pki/tls shared && make --jobs=$JOBS && make --jobs=$JOBS install || true && make --jobs=$JOBS install_runtime | ||
|
||
####### Azure SDK | ||
|
||
WORKDIR /azure | ||
RUN apt-get install -y uuid uuid-dev | ||
RUN git clone https://github.com/Microsoft/cpprestsdk.git && cd cpprestsdk && git checkout tags/v2.10.18 -b v2.10.18 && git submodule update --init | ||
|
||
RUN git clone https://github.com/Azure/azure-storage-cpp.git && cd azure-storage-cpp/Microsoft.WindowsAzure.Storage && git checkout tags/v7.5.0 && mkdir build.release | ||
|
||
WORKDIR / | ||
RUN cp -rf /ovms/third_party/cpprest/rest_sdk_v2.10.16.patch /azure/cpprestsdk/ | ||
RUN cd /azure/cpprestsdk/ && patch -p1 < rest_sdk_v2.10.16.patch | ||
RUN cp -rf /ovms/third_party/azure/azure_sdk.patch /azure/azure-storage-cpp/ | ||
RUN cd /azure/azure-storage-cpp/ && patch -p1 < azure_sdk.patch | ||
WORKDIR /azure | ||
|
||
RUN cd cpprestsdk && mkdir Release/build.release && cd Release/build.release && cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DWERROR=OFF -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF && make --jobs=$JOBS install | ||
RUN cd azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release && CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=ON && make --jobs=$JOBS && make --jobs=$JOBS install | ||
|
||
####### End of Azure SDK | ||
|
||
# Build AWS S3 SDK | ||
RUN git clone https://github.com/aws/aws-sdk-cpp.git --branch 1.7.129 --single-branch --depth 1 /awssdk | ||
WORKDIR /awssdk/build | ||
RUN OPENSSL_ROOT_DIR=/usr/local/ssl/ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY=s3 -DENABLE_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DFORCE_SHARED_CRT=OFF -DSIMPLE_INSTALL=OFF -DCMAKE_CXX_FLAGS=" -D_GLIBCXX_USE_CXX11_ABI=1 " .. | ||
RUN make --jobs=$JOBS | ||
#RUN mv .deps/install/lib64 .deps/install/lib | ||
|
||
####### End of AWS S3 SDK | ||
|
||
WORKDIR /ovms | ||
|
||
COPY src/ /ovms/src/ | ||
COPY release_files/ /ovms/release_files/ | ||
|
||
# Set OVMS version strings | ||
RUN bash -c "sed -i -e 's|REPLACE_PROJECT_NAME|${PROJECT_NAME}|g' /ovms/src/version.hpp" | ||
RUN if [ "$ov_use_binary" = "1" ] ; then true ; else exit 0 ; fi ; sed -i -e "s#REPLACE_OPENVINO_NAME#`find /opt/intel/ -maxdepth 1 -type d | grep openvino | cut -d'_' -f2`#g" /ovms/src/version.hpp | ||
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/:/opt/intel/openvino/deployment_tools/ngraph/lib/:/opt/intel/openvino/inference_engine/external/tbb/lib/:/openvino/bin/intel64/Release/lib/:/opt/intel/openvino/opencv/lib/ | ||
|
||
RUN bazel build ${debug_bazel_flags} --jobs $JOBS //src:ovms | ||
RUN bazel build ${debug_bazel_flags} --jobs $JOBS //src:libsampleloader.so | ||
|
||
RUN cd /ovms/src/test/cpu_extension/ && make | ||
|
||
RUN bazel test ${debug_bazel_flags} --jobs $JOBS --test_summary=detailed --test_output=all //src:ovms_test | ||
|
||
COPY ${ovms_metadata_file} metadata.json | ||
|
||
RUN ./bazel-bin/src/./ovms --version | ||
RUN ./bazel-bin/src/./ovms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.