@@ -26,6 +26,9 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
26
26
27
27
ARG JOBS=8
28
28
ARG VERBOSE_LOGS=OFF
29
+ ARG LTO_ENABLE=OFF
30
+ ARG LTO_CXX_FLAGS=""
31
+ ARG LTO_LD_FLAGS="-Wl,-z,relro"
29
32
30
33
# hadolint ignore=DL3041
31
34
RUN echo -e "max_parallel_downloads=8\nretries=50" >> /etc/dnf/dnf.conf && \
@@ -51,7 +54,10 @@ WORKDIR /boost
51
54
RUN wget -nv https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz && \
52
55
if [ "$VERBOSE_LOGS" == "ON" ] ; then export BVERBOSE="-d+2" ; else export BVERBOSE="" ; fi && \
53
56
tar xf boost_1_68_0.tar.gz && cd boost_1_68_0 && ./bootstrap.sh && \
54
- ./b2 -j ${JOBS} cxxstd=17 link=static cxxflags='-fPIC' cflags='-fPIC' \
57
+ ./b2 -j ${JOBS} cxxstd=17 link=static variant=release \
58
+ cxxflags="-fPIC $LTO_CXX_FLAGS" \
59
+ cflags="-fPIC $LTO_CXX_FLAGS" \
60
+ linkflags="$LTO_LD_FLAGS" \
55
61
--with-chrono --with-date_time --with-filesystem \
56
62
--with-program_options --with-system \
57
63
--with-random --with-thread --with-atomic --with-regex \
@@ -65,7 +71,9 @@ COPY third_party/pugixml /ovms/third_party/pugixml
65
71
RUN git clone -b v1.13 https://github.com/zeux/pugixml && \
66
72
cd pugixml && \
67
73
patch -p1 < /ovms/third_party/pugixml/pugixml_v1.13_flags.patch && \
68
- cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && \
74
+ cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} \
75
+ -DCMAKE_CXX_FLAGS="${LTO_CXX_FLAGS}" \
76
+ -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" && \
69
77
make all -j ${JOBS} && \
70
78
cp -P libpugixml.so* /usr/lib64/
71
79
@@ -79,10 +87,10 @@ RUN git clone --recurse-submodules --depth 1 --branch v2.10.16 https://github.co
79
87
patch -d /azure/azure-storage-cpp/ -p1 </ovms/third_party/azure/azure_sdk.patch
80
88
81
89
WORKDIR /azure/cpprestsdk/Release/build.release
82
- RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} -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
90
+ RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} -DCMAKE_CXX_FLAGS="-fPIC ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS} " -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
83
91
84
92
WORKDIR /azure/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release
85
- 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=${VERBOSE_LOGS} && make --jobs=$JOBS && make --jobs=$JOBS install
93
+ RUN CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="-fPIC ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS} " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && make --jobs=$JOBS && make --jobs=$JOBS install
86
94
####### End of Azure SDK
87
95
88
96
####### Build OpenCV
@@ -99,6 +107,7 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
99
107
100
108
ARG JOBS=40
101
109
ARG VERBOSE_LOGS=OFF
110
+ ARG LTO_ENABLE=OFF
102
111
103
112
# hadolint ignore=DL3041
104
113
RUN dnf install -y https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/opencl-headers-3.0-6.20201007gitd65bcc5.el9.noarch.rpm && \
@@ -165,9 +174,12 @@ RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.n
165
174
# hadolint ignore=DL3003
166
175
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; git clone https://github.com/$ov_source_org/openvino.git /openvino && cd /openvino && git checkout $ov_source_branch && git submodule update --init --recursive
167
176
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; pip3 install --no-cache-dir -r /openvino/src/bindings/python/wheel/requirements-dev.txt
177
+ WORKDIR /openvino
178
+ COPY openvino-lto.patch .
179
+ RUN if [ "$ov_use_binary" == "0" ]; then patch -p1 < openvino-lto.patch ; rm -f openvino-lto.patch ; fi
168
180
WORKDIR /openvino/build
169
- RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_PYTHON=ON -DENABLE_INTEL_NPU=OFF -DENABLE_SAMPLES=0 -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses " ..
170
- RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_SAMPLES=0 -DENABLE_INTEL_NPU=OFF -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses " ..
181
+ RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_LTO=${LTO_ENABLE} - DENABLE_PYTHON=ON -DENABLE_INTEL_NPU=OFF -DENABLE_SAMPLES=0 -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" ..
182
+ RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_LTO=${LTO_ENABLE} - DENABLE_SAMPLES=0 -DENABLE_INTEL_NPU=OFF -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS} " ..
171
183
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make --jobs=$JOBS
172
184
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make install
173
185
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; \
@@ -214,7 +226,7 @@ ARG ov_tokenizers_branch=master
214
226
# hadolint ignore=DL3003
215
227
RUN git clone https://github.com/openvinotoolkit/openvino_tokenizers.git /openvino_tokenizers && cd /openvino_tokenizers && git checkout $ov_tokenizers_branch && git submodule update --init --recursive
216
228
WORKDIR /openvino_tokenizers/build
217
- RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" && cmake --build . --parallel $JOBS ; cp /openvino_tokenizers/build/src/lib*.so /opt/intel/openvino/runtime/lib/intel64/
229
+ RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DCMAKE_CXX_FLAGS=" ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" && cmake --build . --parallel $JOBS ; cp /openvino_tokenizers/build/src/lib*.so /opt/intel/openvino/runtime/lib/intel64/
218
230
219
231
# Build OpenVINO Model Server
220
232
WORKDIR /ovms
@@ -283,8 +295,8 @@ RUN bazel build --jobs=$JOBS ${debug_bazel_flags} ${minitrace_flags} //src:ovms
283
295
COPY ci/check_coverage.bat /ovms/
284
296
ARG CHECK_COVERAGE=0
285
297
ARG RUN_TESTS=0
286
- COPY run_unit_tests.sh prepare_llm_models.sh prepare_gpu_models.sh /ovms/
287
- RUN if [ "$RUN_TESTS" == "1" ] ; then ./prepare_llm_models.sh /ovms/src/test/llm_testing docker && ./run_unit_tests.sh ; fi
298
+ COPY run_unit_tests.sh prepare_llm_models.sh prepare_gpu_models.sh demos/common/export_models/export_model.py /ovms/
299
+ RUN if [ "$RUN_TESTS" == "1" ] ; then mkdir -p demos/common/export_models/ && mv export_model.py demos/common/export_models/ && ./prepare_llm_models.sh /ovms/src/test/llm_testing docker && ./run_unit_tests.sh ; fi
288
300
289
301
ARG ovms_metadata_file
290
302
@@ -391,5 +403,14 @@ COPY --from=pkg /usr/local/lib64/python3.*/site-packages/MarkupSafe-3.0.2.dist-i
391
403
COPY --from=pkg /usr/local/lib64/python3.*/site-packages/markupsafe /ovms/python_deps/markupsafe
392
404
393
405
COPY --from=pkg /licenses /licenses
406
+
407
+ # Setup Python Demos Environment
408
+ COPY demos/python_demos/requirements.txt .
409
+ RUN if [ -f /usr/bin/dnf ] ; then export DNF_TOOL=dnf ; \
410
+ else export DNF_TOOL=microdnf ; fi ; \
411
+ $DNF_TOOL install -y python3-pip git iproute net-tools ; $DNF_TOOL clean all ; \
412
+ pip3 install --no-cache-dir -r requirements.txt ; \
413
+ rm -f requirements.txt
414
+
394
415
USER ovms
395
416
ENTRYPOINT ["/ovms/bin/ovms"]
0 commit comments