Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -263,26 +263,17 @@ 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.


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

COPY src/ /ovms/src/

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

# Sample CPU Extension
WORKDIR /ovms/src/example/SampleCpuExtension/
RUN make
Expand All @@ -308,9 +299,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
Expand Down Expand Up @@ -370,16 +358,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
31 changes: 16 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ $(error PYTHON_DISABLE cannot be 0 when MEDIAPIPE_DISABLE is 1)
endif
endif
FUZZER_BUILD ?= 0

DOCKER_BUILDKIT ?= 1
# 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 @@ -355,13 +355,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 +382,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 +446,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 @@ -110,8 +110,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 && \
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.

Why is this removed?

tar cf ovms.tar --transform 's/ovms_release/ovms/' /ovms_release/
cd /ovms_release
ls -l