forked from openvinotoolkit/mediapipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.openvino
187 lines (163 loc) · 7.88 KB
/
Dockerfile.openvino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#
# 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
FROM ubuntu:20.04
LABEL version="0.0.1"
ARG JOBS=16
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
#######
# Install dependencies
#######
# # to avoid question for continent
ENV DEBIAN_FRONTEND=noninteractive
# Install unit tests and examples requierments
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
ffmpeg \
git \
wget \
unzip \
nodejs \
npm \
python3-dev \
python3-opencv \
python3-pip \
libopencv-core-dev \
libopencv-highgui-dev \
libopencv-imgproc-dev \
libopencv-video-dev \
libopencv-calib3d-dev \
libopencv-features2d-dev \
software-properties-common && \
add-apt-repository -y ppa:openjdk-r/ppa && \
apt-get update && apt-get install -y openjdk-8-jdk && \
apt-get install -y mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev && \
apt-get install -y mesa-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# python setup.py requirements
RUN pip3 install --upgrade setuptools
RUN pip3 install wheel future absl-py numpy opencv-contrib-python tensorflow==2.9.0 protobuf==3.20.1 six==1.14.0 tf_slim
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt-get update && apt-get install -y protobuf-compiler
# Install unit tests and examples requierments
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 && \
mv bazelisk-linux-amd64 /usr/bin/bazelisk && chmod +x /usr/bin/bazelisk
RUN apt-get update && apt-get install --no-install-recommends -y \
cmake \
automake \
autoconf \
curl \
libcurl4-openssl-dev \
git \
wget \
vim \
ca-certificates \
python3 \
python3-numpy \
pip \
libopencv-core-dev \
libopencv-highgui-dev \
libopencv-calib3d-dev \
libopencv-features2d-dev \
libopencv-imgproc-dev \
libopencv-video-dev \
build-essential \
libboost-filesystem1.71.0 \
libboost-thread1.71.0 \
libboost-program-options1.71.0 \
libboost-chrono1.71.0 \
libboost-date-time1.71.0 \
libboost-atomic1.71.0 \
libjson-c4 \
unzip
# install ovms_lib requirements
# xml2, uuid for azure
RUN apt-get install -y curl libpugixml1v5 libtbb2 libxml2-dev uuid-dev uuid libssl-dev --no-install-recommends
RUN apt-get update && apt-get install --no-install-recommends -y libtool
# Install bazel
ARG BAZEL_VERSION=5.3.1
RUN mkdir /bazel && \
wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\
azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
wget --no-check-certificate -O /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \
chmod +x /bazel/installer.sh && \
/bazel/installer.sh && \
rm -f /bazel/installer.sh
#OPENVINO
ARG DLDT_PACKAGE_URL=https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0/linux/l_openvino_toolkit_ubuntu20_2023.0.0.10926.b4452d56304_x86_64.tgz
# OV toolkit package
RUN wget -nv $DLDT_PACKAGE_URL && \
mkdir /opt/intel && \
tar -zxf l_openvino_toolkit*.tgz -C /opt/intel && \
ln -s /opt/intel/l_openvino_toolkit* /opt/intel/openvino && \
ln -s /opt/intel/l_openvino_toolkit* /opt/intel/openvino_2022
####### Azure SDK needs new boost:
WORKDIR /boost
# hadolint ignore=DL3003
RUN wget -nv https://sourceforge.net/projects/boost/files/boost/1.69.0/boost_1_69_0.tar.gz && \
tar xvf boost_1_69_0.tar.gz && cd boost_1_69_0 && ./bootstrap.sh && \
./b2 -j ${JOBS} 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
ARG OVMS_BRANCH="mediapipe_integration"
RUN mkdir /opt/ovms
RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/cpprest/rest_sdk_v2.10.16.patch
RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/azure/azure_sdk.patch
RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/build_bazel_rules_apple/bazel_rules_apple.patch
RUN mkdir -p /root/ovms/dummy/1
RUN wget -nv -O /root/ovms/config.json https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/mediapipe/config_standard_dummy.json
RUN sed -i 's:/ovms/src/test/dummy:/root/ovms/dummy:g' /root/ovms/config.json
RUN wget -nv -O /root/ovms/dummy/1/dummy.xml https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/dummy/1/dummy.xml
RUN wget -nv -O /root/ovms/dummy/1/dummy.bin https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/dummy/1/dummy.bin
####### Azure SDK
WORKDIR /azure
RUN apt-get update && apt-get install --no-install-recommends -y uuid uuid-dev && rm -rf /var/lib/apt/lists/*
RUN git clone --recurse-submodules --depth 1 --branch v2.10.16 https://github.com/Microsoft/cpprestsdk.git && \
git clone --depth 1 --branch v7.5.0 https://github.com/Azure/azure-storage-cpp.git && \
patch -d /azure/cpprestsdk/ -p1 < /opt/ovms/rest_sdk_v2.10.16.patch && \
patch -d /azure/azure-storage-cpp/ -p1 < /opt/ovms/azure_sdk.patch
WORKDIR /azure/cpprestsdk/Release/build.release
RUN 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
WORKDIR /azure/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release
RUN 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 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 " .. && make --jobs=$JOBS
####### End of AWS S3 SDK
####### Build OpenCV
COPY setup_opencv.sh /mediapipe/setup_opencv.sh
COPY third_party/opencv_linux.BUILD /mediapipe/third_party/opencv_linux.BUILD
COPY WORKSPACE /mediapipe/WORKSPACE
WORKDIR /mediapipe
RUN ./setup_opencv.sh
####### End of OpenCV
# tools for pose_detection model convertion for missing tflite densify op nodes support workaround
RUN pip3 install tflite2tensorflow pandas==1.4.2 gdown tensorflow-datasets
RUN wget https://github.com/PINTO0309/tflite2tensorflow/raw/main/schema/schema.fbs
RUN git clone -b v2.0.8 https://github.com/google/flatbuffers.git
RUN cd flatbuffers && mkdir build && cd build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. && make -j$(nproc) && cd ../..
COPY . /mediapipe/
# BUILD examples
ENV GLOG_logtostderr=1
ENV LD_LIBRARY_PATH="/opt/intel/openvino/runtime/lib/intel64/:${LD_LIBRARY_PATH}"
RUN bash build_desktop_examples.sh -b