forked from openvinotoolkit/model_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfileMakePackage
79 lines (65 loc) · 5.1 KB
/
DockerfileMakePackage
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
#
# Copyright (c) 2020 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 BUILD_IMAGE=ovms-centos:latest
FROM $BUILD_IMAGE
ARG ov_use_binary=1
RUN yum install -y xz
RUN mkdir /patchelf && cd /patchelf && \
wget https://github.com/NixOS/patchelf/archive/0.10.tar.gz && \
tar -xf 0.10.tar.gz && ls -lah && cd */ && \
./bootstrap.sh && ./configure && make && make install
RUN mkdir -vp /ovms_release/bin
RUN mkdir -vp /ovms_release/deps
RUN mkdir -vp /ovms_release/lib
RUN mkdir -vp /ovms_release/lib/hddl/config
RUN cp /ovms/metadata.json /ovms_release/
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cp -v /openvino/bin/intel64/Release/lib/plugins.xml /ovms_release/lib/
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; cp -v /opt/intel/openvino/deployment_tools/inference_engine/external/hddl/config/* /ovms_release/lib/hddl/config/ || true
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; cp -v /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/plugins.xml /ovms_release/lib/ && cp /opt/intel/openvino/install_dependencies/* /ovms_release/deps/
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; rm -vrf /ovms_release/deps/*-devel-*
RUN find /ovms/bazel-out/k8-*/bin -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN cd /ovms_release/lib/ ; rm -f libazurestorage.so.* ; ln -s libazurestorage.so libazurestorage.so.7 ;ln -s libazurestorage.so libazurestorage.so.7.5
RUN cd /ovms_release/lib/ ; rm -f libcpprest.so.2.10 ; ln -s libcpprest.so libcpprest.so.2.10
RUN rm -f /ovms_release/lib/libsampleloader*
RUN rm -f /ovms_release/lib/lib_node*
RUN rm -f /ovms_release/lib/libcustom_node*
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; find /openvino/ -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/ -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/ -iname '*.mvcmd*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/deployment_tools/inference_engine/external/ -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/deployment_tools/ngraph/lib/ -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/deployment_tools/inference_engine/external/ -iname '*.so*' -exec cp -v {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; find /opt/intel/openvino/opencv/lib/ -iname '*.so*' -exec cp -vP {} /ovms_release/lib/ \;
RUN if [ "$ov_use_binary" == "1" ] ; then true ; else exit 0 ; fi ; cp /opt/intel/openvino/opencv/etc/licenses/* /ovms/release_files/thirdparty-licenses/;
RUN find /usr/lib64/ -iname 'libcrypto.so*' -exec cp -vP {} /ovms_release/lib/ \;
RUN if [ -f /ovms_release/lib/libbsl.so.0 ] ; then cd /ovms_release/lib/ ; rm -f libbsl.so.0 ; ln -s libbsl.so libbsl.so.0 ; fi
RUN if [ -f /ovms_release/lib/libmvnc-hddl.so.0 ] ; then cd /ovms_release/lib/ ; rm -f libmvnc-hddl.so.0 ; ln -s libmvnc-hddl.so libmvnc-hddl.so.0 ; fi
RUN if [ -f /ovms_release/lib/libion.so.0 ] ; then cd /ovms_release/lib/ ; rm -f libion.so.0 ; ln -s libion.so libion.so.0 ; fi
RUN find /ovms/bazel-bin/src -name 'ovms' -type f -exec cp -v {} /ovms_release/bin \;
WORKDIR /ovms_release/bin
RUN patchelf --remove-rpath ./ovms && patchelf --set-rpath '$ORIGIN/../lib/' ./ovms
RUN find /ovms_release/lib/ -iname '*.so*' -exec patchelf --debug --remove-rpath {} \;
RUN find /ovms_release/lib/ -iname '*.so*' -exec patchelf --debug --set-rpath '$ORIGIN/../lib' {} \;
WORKDIR /ovms
RUN cp -v /ovms/release_files/LICENSE /ovms_release/
RUN cp -rv /ovms/release_files/thirdparty-licenses /ovms_release/
RUN ls -lahR /ovms_release/
RUN find /ovms_release/lib/ -iname '*.so*' -type f -exec patchelf --remove-rpath {} \;
RUN find /ovms_release/lib/ -iname '*.so*' -type f -exec patchelf --set-rpath '$ORIGIN/../lib' {} \;
WORKDIR /
RUN tar czf ovms.tar.gz --transform 's/ovms_release/ovms/' /ovms_release/ && sha256sum ovms.tar.gz > ovms.tar.gz.sha256 && cp /ovms_release/metadata.json /ovms.tar.gz.metadata.json
RUN tar cJf ovms.tar.xz --transform 's/ovms_release/ovms/' /ovms_release/ && sha256sum ovms.tar.xz > ovms.tar.xz.sha256 && cp /ovms_release/metadata.json /ovms.tar.xz.metadata.json
ENTRYPOINT [ ]