Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix python packages handling on ubuntu20 #2833

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down Expand Up @@ -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
Expand All @@ -401,6 +402,11 @@ 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 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/

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

FROM $BASE_IMAGE as release
Expand Down Expand Up @@ -453,10 +459,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 ; \
Expand Down