Skip to content

Commit ad8743d

Browse files
Update Dockerfile.redhat
1 parent 43f4cd0 commit ad8743d

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

Dockerfile.redhat

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#
1+
##
22
# Copyright (c) 2020-2023 Intel Corporation
3-
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
65
# You may obtain a copy of the License at
@@ -12,23 +11,22 @@
1211
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
# See the License for the specific language governing permissions and
1413
# limitations under the License.
15-
#
1614

17-
ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.5
15+
ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.6
1816
ARG BUILD_IMAGE=build
1917
ARG PKG_IMAGE=pkg
20-
ARG RELEASE_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:9.5
18+
ARG RELEASE_BASE_IMAGE=registry.access.redhat.com/ubi9-minimal:9.6
2119

2220
FROM $BASE_IMAGE as base_build
23-
ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.5
21+
ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.6
2422

2523
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
2624

27-
ARG JOBS=8
28-
ARG VERBOSE_LOGS=OFF
29-
ARG LTO_ENABLE=OFF
30-
ARG LTO_CXX_FLAGS=""
31-
ARG LTO_LD_FLAGS="-Wl,-z,relro"
25+
ARG JOBS=16
26+
ARG VERBOSE_LOGS=ON
27+
ARG LTO_ENABLE=ON
28+
ARG LTO_CXX_FLAGS="-flto=auto -ffat-lto-objects -march=haswell"
29+
ARG LTO_LD_FLAGS="-flto=auto -ffat-lto-objects"
3230

3331
# hadolint ignore=DL3041
3432
RUN echo -e "max_parallel_downloads=8\nretries=50" >> /etc/dnf/dnf.conf && \
@@ -101,13 +99,13 @@ RUN if [ "$VERBOSE_LOGS" == "ON" ] ; then export VERBOSE=1 ; fi && ./install_ope
10199

102100
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
103101
FROM base_build as build
104-
ARG BASE_IMAGE
102+
ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.6
105103

106104
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
107105

108-
ARG JOBS=40
109-
ARG VERBOSE_LOGS=OFF
110-
ARG LTO_ENABLE=OFF
106+
ARG JOBS=16
107+
ARG VERBOSE_LOGS=ON
108+
ARG LTO_ENABLE=ON
111109

112110
# hadolint ignore=DL3041
113111
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 && \
@@ -123,7 +121,7 @@ RUN dnf install -y https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os
123121
unzip \
124122
vim \
125123
xz \
126-
python3-devel \
124+
python3-devel \
127125
libicu-devel && \
128126
dnf clean all
129127

@@ -157,15 +155,15 @@ RUN dnf install -y https://github.com/linux-test-project/lcov/releases/download
157155

158156
ENV TF_SYSTEM_LIBS="curl"
159157
ENV TEST_LOG="/root/.cache/bazel/_bazel_root/bc57d4817a53cab8c785464da57d1983/execroot/ovms/bazel-out/test.log"
160-
ARG ov_source_branch=master
161-
ARG ov_contrib_branch=master
162-
ARG ov_source_org=openvinotoolkit
163-
ARG ov_contrib_org=openvinotoolkit
158+
ARG ov_source_branch=releases/2025/1
159+
ARG ov_contrib_branch=releases/2025/1
160+
ARG ov_source_org=opendatahub-io
161+
ARG ov_contrib_org=opendatahub-io
164162
ARG ov_use_binary=0
165163
ARG DLDT_PACKAGE_URL
166164
ARG TEMP_DIR=/tmp/openvino_installer
167165
ARG CMAKE_BUILD_TYPE=Release
168-
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
166+
ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --config=mp_on_py_on --verbose_failures --//:distro=redhat --local_ram_resources=23552 --local_cpu_resources=16"
169167

170168
################### BUILD OPENVINO FROM SOURCE - buildarg ov_use_binary=0 ############################
171169
# hadolint ignore=DL3041
@@ -222,7 +220,7 @@ RUN if [ -f /opt/intel/openvino/samples/cpp/build_samples.sh ]; then /opt/intel
222220
ENV OpenVINO_DIR=/opt/intel/openvino/runtime/cmake
223221
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/intel/openvino/runtime/lib/intel64/:/opt/opencv/lib/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/
224222

225-
ARG ov_tokenizers_branch=master
223+
ARG ov_tokenizers_branch=releases/2025/1
226224
# hadolint ignore=DL3003
227225
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
228226
WORKDIR /openvino_tokenizers/build
@@ -281,7 +279,7 @@ ENV PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding
281279

282280
WORKDIR /ovms
283281

284-
ARG PROJECT_VERSION="2025.1"
282+
ARG PROJECT_VERSION="2025.1.0"
285283
LABEL description="OpenVINO Model Server"
286284
ARG minitrace_flags
287285

@@ -323,26 +321,49 @@ RUN python3 -c "import json; m={'PROJECT_VERSION':'${PROJECT_VERSION}','OPENVINO
323321

324322
FROM $BUILD_IMAGE as capi-build
325323
# C api shared library
326-
ARG CAPI_FLAGS="--strip=always --config=mp_off_py_off --//:distro=redhat"
327-
ARG JOBS=40
328-
RUN bazel build --jobs $JOBS ${CAPI_FLAGS} //src:ovms_shared
324+
ARG CAPI_FLAGS="--strip=always --config=mp_off_py_off --verbose_failures --//:distro=redhat --local_ram_resources=23552 --local_cpu_resources=16 --subcommands"
325+
ARG JOBS=16
326+
327+
#RUN bazel build --jobs $JOBS ${CAPI_FLAGS} //src:ovms_shared
328+
329+
RUN mkdir -p /tmp/bazel-output && \
330+
bazel --output_base=/tmp/bazel-output \
331+
build //src:ovms_shared && \
332+
find /tmp/bazel-output -name libovms_shared.so && \
333+
LIB_PATH=$(find /tmp/bazel-output -name libovms_shared.so | head -n1) && \
334+
echo "Found built file: $LIB_PATH" && \
335+
mkdir -p /ovms_release/lib && \
336+
cp -v "$LIB_PATH" /ovms_release/lib/
337+
329338

330339
# C api app with bazel
331340
# hadolint ignore=DL3059
332341
RUN bazel build --jobs $JOBS ${CAPI_FLAGS} //src:capi_cpp_example
333342

334343
# C-API benchmark app
335-
RUN bazel build --jobs=$JOBS ${CAPI_FLAGS} //src:capi_benchmark && ./bazel-bin/src/capi_benchmark --niter 2 --nstreams 1 --servable_name "dummy"
336-
# C-api C/C++ app with gcc
337-
COPY MakefileCapi /ovms/
338-
RUN make -f MakefileCapi cpp CAPI_FLAGS="${CAPI_FLAGS}" && \
339-
make -f MakefileCapi c CAPI_FLAGS="${CAPI_FLAGS}"
344+
RUN bazel build --jobs=$JOBS ${CAPI_FLAGS} //src:capi_benchmark
345+
346+
#workaround for debugging
347+
#RUN find /root/.cache/bazel/ -type f -name '*capi_benchmark*'
348+
349+
#RUN ls -al /ovms_release/lib/
350+
351+
RUN pwd && ls -al
352+
353+
RUN bazel build --jobs=$JOBS ${CAPI_FLAGS} //src:capi_benchmark && \
354+
echo "WORKDIR at build-time: $PWD" && \
355+
bazel info bazel-bin && \
356+
find $(bazel info bazel-bin)/src -type f -name capi_benchmark
340357

341358
RUN mkdir -p /ovms_release/lib/ ; find /ovms/bazel-out/k8-*/bin -iname 'libovms_shared.so' -exec cp -v {} /ovms_release/lib/ \;
359+
#RUN mkdir -p /ovms_release/lib/ ; find $(bazel info bazel-bin) -iname 'libovms_shared.so' -exec cp -v {} /ovms_release/lib/ \;
360+
361+
#debuggig to find the correct lib file
362+
342363

343364
FROM $BUILD_IMAGE as pkg
344365

345-
RUN mkdir /patchelf
366+
RUN mkdir /patchelf
346367
WORKDIR /patchelf
347368
# hadolint ignore=DL3003
348369
RUN wget -q https://github.com/NixOS/patchelf/archive/0.10.tar.gz && \
@@ -353,7 +374,11 @@ WORKDIR /
353374
ARG BASE_OS=redhat
354375
ARG ov_use_binary=0
355376
ARG FUZZER_BUILD=0
356-
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
377+
ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --config=mp_on_py_on --verbose_failures --//:distro=redhat --local_ram_resources=23552 --local_cpu_resources=16"
378+
379+
#workaround to debug
380+
RUN find / -name libovms_shared.so 2>/dev/null || echo "Not found"
381+
357382
COPY --from=capi-build /ovms_release/lib/libovms_shared.so /ovms_release/lib/
358383
COPY create_package.sh /
359384
RUN ./create_package.sh ; if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
@@ -378,11 +403,11 @@ LABEL "description"="OpenVINO(TM) Model Server is a solution for serving AI mode
378403
LABEL "maintainer"="[email protected]"
379404
ARG INSTALL_RPMS_FROM_URL=
380405
ARG INSTALL_DRIVER_VERSION="23.22.26516"
381-
ARG GPU=0
382-
ARG debug_bazel_flags=
406+
ARG GPU=1
407+
ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --config=mp_on_py_on --verbose_failures --//:distro=redhat --local_ram_resources=23552 --local_cpu_resources=16"
383408
LABEL bazel-build-flags=${debug_bazel_flags}
384409
LABEL supported-devices="CPU=1 GPU=${GPU}"
385-
ARG RELEASE_BASE_IMAGE
410+
ARG RELEASE_BASE_IMAGE=registry.access.redhat.com/ubi9-minimal:9.6
386411
LABEL base-image=${RELEASE_BASE_IMAGE}
387412

388413
ENV PYTHONPATH=/ovms/lib/python:/ovms/python_deps

0 commit comments

Comments
 (0)