From ccb4d6047512fc00308edf19d7e80ef2d2015d94 Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Fri, 15 Nov 2024 08:45:49 +0100 Subject: [PATCH 1/3] fix python packages handling on ubuntu20 --- Dockerfile.ubuntu | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 71e089e4bc..4df3b89f41 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -123,7 +123,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ python3 -m pip install "numpy<2.0.0" --no-cache-dir && \ - python3 -m pip install "Jinja2==3.1.4" "MarkupSafe==3.0.2" --no-cache-dir + python3 -m pip install "Jinja2==3.1.4" "MarkupSafe" --no-cache-dir RUN apt-get update; apt-get install -y --no-install-recommends libxml2 && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* @@ -376,6 +376,7 @@ COPY MakefileCapi /ovms/ RUN if [ "$FUZZER_BUILD" == "0" ]; then CAPI_FLAGS=${CAPI_FLAGS} make -f MakefileCapi cpp && \ CAPI_FLAGS=${CAPI_FLAGS} make -f MakefileCapi c; fi ; RUN mkdir -p /ovms_release/lib/ ; find /ovms/bazel-out/k8-*/bin -iname 'libovms_shared.so' -exec cp -v {} /ovms_release/lib/ \; + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # FROM build as pkg @@ -401,6 +402,8 @@ RUN chown -R ovms:ovms /ovms_release && \ # Remove capi library RUN if [ -f /ovms_release/lib/libovms_shared.so ] ; then mv /ovms_release/lib/libovms_shared.so / ; fi ; +RUN cp -R /usr/local/lib/python3*/dist-packages/ /ovms_release/python_deps/ && rm -Rf /ovms_release/python_deps/numpy* + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # FROM $BASE_IMAGE as release @@ -453,10 +456,8 @@ RUN if [ "$NVIDIA" == "1" ]; then true ; else exit 0 ; fi ; echo "installing cud apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* COPY --from=pkg /ovms_release /ovms -COPY --from=build /usr/local/lib/python3.*/dist-packages/MarkupSafe-3.0.2.dist-info /ovms/python_deps/MarkupSafe-3.0.2.dist-info -COPY --from=build /usr/local/lib/python3.*/dist-packages/jinja2 /ovms/python_deps/jinja2 -COPY --from=build /usr/local/lib/python3.*/dist-packages/jinja2-3.1.4.dist-info /ovms/python_deps/jinja2-3.1.4.dist-info -COPY --from=build /usr/local/lib/python3.*/dist-packages/markupsafe /ovms/python_deps/markupsafe +COPY --from=pkg /ovms_release/python_deps /ovms/python_deps/ + # For image with Python enabled install Python library RUN if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; \ From a3693c3240472c8c4d3ede4324f299a30e190fed Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Fri, 15 Nov 2024 16:18:00 +0100 Subject: [PATCH 2/3] limit the python deps --- Dockerfile.ubuntu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 4df3b89f41..f1c59463de 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -402,7 +402,9 @@ RUN chown -R ovms:ovms /ovms_release && \ # Remove capi library RUN if [ -f /ovms_release/lib/libovms_shared.so ] ; then mv /ovms_release/lib/libovms_shared.so / ; fi ; -RUN cp -R /usr/local/lib/python3*/dist-packages/ /ovms_release/python_deps/ && rm -Rf /ovms_release/python_deps/numpy* +RUN cp -R /usr/local/lib/python3*/dist-packages/jinja2* /ovms_release/python_deps/ && \ + cp -R /usr/local/lib/python3*/dist-packages/MarkupSafe* /ovms_release/python_deps/ && \ + cp -R /usr/local/lib/python3*/dist-packages/markupsafe /ovms_release/python_deps/ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # From 5fcd8aa5d906d65a68c64aab0e1bb91831f7850a Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Fri, 15 Nov 2024 16:20:18 +0100 Subject: [PATCH 3/3] limit the python deps --- Dockerfile.ubuntu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index f1c59463de..d602be1ac1 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -402,7 +402,8 @@ RUN chown -R ovms:ovms /ovms_release && \ # Remove capi library RUN if [ -f /ovms_release/lib/libovms_shared.so ] ; then mv /ovms_release/lib/libovms_shared.so / ; fi ; -RUN cp -R /usr/local/lib/python3*/dist-packages/jinja2* /ovms_release/python_deps/ && \ +RUN mkdir /ovms_release/python_deps && \ + cp -R /usr/local/lib/python3*/dist-packages/jinja2* /ovms_release/python_deps/ && \ cp -R /usr/local/lib/python3*/dist-packages/MarkupSafe* /ovms_release/python_deps/ && \ cp -R /usr/local/lib/python3*/dist-packages/markupsafe /ovms_release/python_deps/