From 1c76cbd54117b4f10f3e6c1be4e668438c842806 Mon Sep 17 00:00:00 2001 From: Louis Brunner Date: Tue, 20 Feb 2024 20:27:11 +0000 Subject: [PATCH] build: copy python packages into /usr instead of ~ros2 to avoid permission issues (#69) --- CHANGELOG.md | 1 + Dockerfile | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f30bb9a..36f4cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Release Versions: ## Upcoming changes (in development) +- build: copy python packages into /usr instead of ~ros2 to avoid permission issues (#69) - feat: add is_opened flag to socket base class (#68) ## 2.0.1 diff --git a/Dockerfile b/Dockerfile index 0c65739..cea065f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,8 +80,7 @@ COPY --from=install /tmp/communication-interfaces /usr COPY --chown=${USER}:${USER} ./python /python RUN --mount=type=cache,target=${HOME}/.cache,id=pip-${TARGETPLATFORM}-${CACHEID},uid=1000 \ python3 -m pip install --prefix=/tmp/python /python -RUN mkdir -p /tmp/python-home/${USER}/.local/lib/python3.10/ \ - && mv /tmp/python/local/lib/python3.10/dist-packages/ /tmp/python-home/${USER}/.local/lib/python3.10/site-packages/ +RUN mv /tmp/python/local /tmp/python-usr FROM build as test ARG TARGETPLATFORM @@ -89,7 +88,7 @@ ARG CACHEID RUN --mount=type=cache,target=./build,id=cmake-${TARGETPLATFORM}-${CACHEID},uid=1000 \ cmake -B build -DBUILD_TESTING=ON && cd build && make && CTEST_OUTPUT_ON_FAILURE=1 make test COPY --from=install /tmp/communication-interfaces /usr/local -COPY --from=python /tmp/python-home/ /home +COPY --from=python /tmp/python-usr /usr COPY --from=python /python/test /python/test RUN python3 -m pytest /python/test --verbose @@ -98,7 +97,7 @@ ARG TARGETPLATFORM ARG CACHEID COPY --from=apt-dependencies /tmp/apt / COPY --from=install /tmp/communication-interfaces /usr -COPY --from=python /tmp/python-home /home +COPY --from=python /tmp/python-usr /usr RUN sudo pip install pybind11-stubgen RUN --mount=type=cache,target=${HOME}/.cache,id=pip-${TARGETPLATFORM}-${CACHEID},uid=1000 \ <