Skip to content
32 changes: 10 additions & 22 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ RUN curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHT

RUN dnf install -y https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16-1.noarch.rpm && dnf clean all

WORKDIR /patchelf
# hadolint ignore=DL3003
RUN wget -q https://github.com/NixOS/patchelf/archive/0.10.tar.gz && \
tar -xf 0.10.tar.gz && cd patchelf-0.10 && \
./bootstrap.sh && ./configure && make && make install

ENV TF_SYSTEM_LIBS="curl"
ENV TEST_LOG="/root/.cache/bazel/_bazel_root/bc57d4817a53cab8c785464da57d1983/execroot/ovms/bazel-out/test.log"
ARG ov_source_branch=c01cd93e24d1cd78bfbb401eed51c08fb93e0816
Expand Down Expand Up @@ -263,25 +269,20 @@ COPY src/python/binding/tests/requirements.txt /ovms/src/python/binding/tests/re

WORKDIR /ovms

# hadolint ignore=DL3059

# Mediapipe
COPY BUILD.bazel /ovms/
COPY *\.bzl /ovms/
COPY yarn.lock /ovms/
COPY package.json /ovms/

# prebuild dependencies before copying sources
# hadolint ignore=DL3059
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //:ovms_dependencies @com_google_googletest//:gtest
Comment on lines -274 to -276
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing all those steps will mean that all those dependencies are not cached in docker layers up until L321:
https://github.com/openvinotoolkit/model_server/pull/4159/changes#diff-507d73bbefd62da3db1eec3a006d6f4bf47433fec017a5299f63921bd0a605b0L321
So basically that means they are never cached in docker. With bazel remote cache that would not be an issue but in every other case its mean recompiling most of ovms dependencies each time anything in our srcs change (L281).

Unless proven empirically that those dependencies recompile anyway, its a no go for me.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this might be useful to have

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the evidence https://ci.iotg.sclab.intel.com/job/ovmsc/job/OVMSCOps_SDL_copy/328/console that all the dependencies are included in //src:ovms target


# hadolint ignore=DL3059
RUN cp -v /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt

COPY src/ /ovms/src/
ARG KONFLUX=1 # This is a workaround to avoid bazel fetching dependencies during build, which causes issues in Konflux. Should be disabled when building outside of Konflux to speed up the build by using bazel cache and avoid fetching dependencies which are already cached.
RUN if [ "$KONFLUX" == "0" ] ; then true ; else exit 0 ; fi ; \
bazel build --jobs=$JOBS ${debug_bazel_flags} //:ovms_dependencies @com_google_googletest//:gtest

# hadolint ignore=DL3059
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @org_tensorflow//tensorflow/core:framework
COPY src/ /ovms/src/

# Sample CPU Extension
WORKDIR /ovms/src/example/SampleCpuExtension/
Expand All @@ -292,12 +293,6 @@ RUN if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ;
echo $'Metadata-Version: 1.0\nName: openvino\nVersion: 2026.2' > /opt/intel/openvino/python/openvino-4.dist-info/METADATA
ENV PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding

WORKDIR /patchelf
# hadolint ignore=DL3003
RUN wget -q https://github.com/NixOS/patchelf/archive/0.10.tar.gz && \
tar -xf 0.10.tar.gz && cd patchelf-0.10 && \
./bootstrap.sh && ./configure && make && make install

WORKDIR /ovms

ARG PROJECT_VERSION="2026.2.0"
Expand All @@ -308,9 +303,6 @@ ARG minitrace_flags
RUN bash -c "sed -i -e 's|REPLACE_PROJECT_VERSION|${PROJECT_VERSION}|g' /ovms/src/version.hpp" && \
bash -c "sed -i -e 's|REPLACE_BAZEL_BUILD_FLAGS|${debug_bazel_flags}${minitrace_flags}|g' /ovms/src/version.hpp"

# Custom Nodes
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //src:release_custom_nodes

# OVMS
ARG OPTIMIZE_BUILDING_TESTS=0
RUN rm -f /usr/lib64/cmake/OpenSSL/OpenSSLConfig.cmake
Comment on lines 306 to 308
Expand Down Expand Up @@ -370,16 +362,12 @@ ARG BASE_OS=redhat
ARG ov_use_binary=0
ARG FUZZER_BUILD=0
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
COPY --from=capi-build /ovms_release/lib/libovms_shared.so /ovms_release/lib/
COPY create_package.sh /
RUN ./create_package.sh

# hadolint ignore=DL3059
RUN chown -R ovms:ovms /ovms_release
RUN mkdir /licenses && ln -s /ovms_release/LICENSE /licenses && ln -s /ovms_release/thirdparty-licenses /licenses/thirdparty-licenses
# Remove capi library
RUN if [ -f /ovms_release/lib/libovms_shared.so ] ; then mv /ovms_release/lib/libovms_shared.so / ; else exit 0 ; fi ;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #


FROM $RELEASE_BASE_IMAGE as release
Expand Down
35 changes: 19 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ $(error PYTHON_DISABLE cannot be 0 when MEDIAPIPE_DISABLE is 1)
endif
endif
FUZZER_BUILD ?= 0

DOCKER_BUILDKIT ?= 1
KONFLUX ?= 0
# NOTE: when changing any value below, you'll need to adjust WORKSPACE file by hand:
# - uncomment source build section, comment binary section
# - adjust binary version path - version variable is not passed to WORKSPACE file!
Expand Down Expand Up @@ -240,7 +241,8 @@ BUILD_ARGS = --build-arg http_proxy=$(HTTP_PROXY)\
--build-arg RELEASE_BASE_IMAGE=$(BASE_IMAGE_RELEASE)\
--build-arg JOBS=$(JOBS)\
--build-arg CAPI_FLAGS=$(CAPI_FLAGS)\
--build-arg VERBOSE_LOGS=$(VERBOSE_LOGS)
--build-arg VERBOSE_LOGS=$(VERBOSE_LOGS)\
--build-arg KONFLUX=$(KONFLUX)


.PHONY: default docker_build \
Expand Down Expand Up @@ -355,13 +357,10 @@ ifeq ($(NO_DOCKER_CACHE),true)
@docker pull registry.access.redhat.com/ubi9/ubi-minimal:$(BASE_OS_TAG_REDHAT)
endif
endif
ifeq ($(USE_BUILDX),true)
$(eval BUILDX:=buildx)
endif

ifeq ($(BUILD_CUSTOM_NODES),true)
@echo "Building custom nodes"
@cd src/custom_nodes && make USE_BUILDX=$(USE_BUILDX) NO_DOCKER_CACHE=$(NO_DOCKER_CACHE) BASE_OS=$(OS) BASE_IMAGE=$(BASE_IMAGE)
@cd src/custom_nodes && make NO_DOCKER_CACHE=$(NO_DOCKER_CACHE) BASE_OS=$(OS) BASE_IMAGE=$(BASE_IMAGE)
endif
@echo "Building docker image $(BASE_OS)"
# Provide metadata information into image if defined
Expand All @@ -385,15 +384,23 @@ targz_package:
--target=pkg && \
rm -vrf dist/$(OS) && mkdir -p dist/$(OS) && \
ID=$$(docker create $(OVMS_CPP_DOCKER_IMAGE)-pkg:$(OVMS_CPP_IMAGE_TAG)) && \
docker cp $$ID:/ovms_pkg/$(OS) dist/ && \
docker cp $$ID:/ovms_pkg/$(OS)/ovms.tar dist/$(OS)/ && \
docker rm $$ID
docker $(BUILDX) build -f Dockerfile.$(DIST_OS) . \
$(BUILD_ARGS) \
--build-arg BUILD_IMAGE=$(BUILD_IMAGE) \
-t $(OVMS_CPP_DOCKER_IMAGE)-capi:$(OVMS_CPP_IMAGE_TAG) \
--target=capi-build && \
ID=$$(docker create $(OVMS_CPP_DOCKER_IMAGE)-capi:$(OVMS_CPP_IMAGE_TAG)) && \
docker cp $$ID:/ovms_release/lib/libovms_shared.so dist/$(OS)/ && \
docker rm $$ID
cd dist/$(OS) && sha256sum --check ovms.tar.gz.sha256
cd dist/$(OS) && \
tar rf ovms.tar --transform 's,^,ovms/lib/,' libovms_shared.so && \
gzip ovms.tar && \
rm -f libovms_shared.so && \
sha256sum ovms.tar.gz > ovms.tar.gz.sha256

ovms_release_images:
ifeq ($(USE_BUILDX),true)
$(eval BUILDX:=buildx)
$(eval NO_CACHE_OPTION:=--no-cache-filter release)
endif
ifeq ($(BASE_OS),redhat)
$(eval NPU:=0)
else
Expand Down Expand Up @@ -441,10 +448,6 @@ ifeq ($(BASE_OS),redhat)
endif

release_image:
ifeq ($(USE_BUILDX),true)
$(eval BUILDX:=buildx)
$(eval NO_CACHE_OPTION:=--no-cache-filter release)
endif
docker $(BUILDX) build $(NO_CACHE_OPTION) -f Dockerfile.$(DIST_OS) . \
$(BUILD_ARGS) \
--build-arg BUILD_IMAGE=$(BUILD_IMAGE) \
Expand Down
3 changes: 1 addition & 2 deletions create_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ find /ovms_release/ovms/lib/python/openvino -name *cpython* | grep -vZ $rls_pyth

mkdir -p /ovms_pkg/${BASE_OS}
cd /ovms_pkg/${BASE_OS}
tar czf ovms.tar.gz --transform 's/ovms_release/ovms/' /ovms_release/
sha256sum ovms.tar.gz > ovms.tar.gz.sha256 && \
Comment thread
atobiszei marked this conversation as resolved.
tar cf ovms.tar --transform 's/ovms_release/ovms/' /ovms_release/
cd /ovms_release
ls -l

4 changes: 1 addition & 3 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,12 @@ Config& Config::parse(int argc, char** argv) {
bool Config::parse(ServerSettingsImpl* serverSettings, ModelsSettingsImpl* modelsSettings) {
this->serverSettings = *serverSettings;
this->modelsSettings = *modelsSettings;

static EnvGuard envGuard;
#if defined(__linux__) || defined(_WIN32)
if (this->serverSettings.logLevel == "DEBUG") {
if (this->serverSettings.logLevel == "DEBUG" || this->serverSettings.logLevel == "TRACE") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this log level settings should be set in the same place as for glog:
https://github.com/openvinotoolkit/model_server/blob/main/src/logging.cpp#L134

This can be fixed in other pR.

envGuard.set("OPENVINO_LOG_LEVEL", "4");
}
#endif

return validate();
}

Expand Down