-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Update Dockerfiles and CI #1942
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b1cd60d
Use colcon to check for build failure
ruffsl 481b6d9
Simplify if case for shell
ruffsl f0561d4
Move extra dockerfiles to docker related folder
ruffsl 4e1bbce
Update Dockerfile location
ruffsl 3554e82
Stage refactor
ruffsl 4d0ad61
Use build kit
ruffsl 66e7c00
Update underlay and overlay build
ruffsl a36b903
Dockerfile tweek
ruffsl e92fafe
Rename underlay .repos file
ruffsl 866e99b
Remove uneeded key
ruffsl 106fadf
Clone matching distro branch by default
ruffsl df3db0e
Add optional directive to RUN colcon test
ruffsl aa4c7ba
Add comments
ruffsl 99d2534
Skip the use of symlinks
ruffsl ab6bcc8
Roll back to nightly image with all rmws
ruffsl b6b439b
Add slam_toolbox to skipped rosdep keys
ruffsl 86f9b66
Set DEBIAN_FRONTEND env to noninteractive
ruffsl a6066db
Update to tag foxy
ruffsl 085bc4a
Updated to latest codecov orb
ruffsl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| # syntax=docker/dockerfile:experimental | ||
|
|
||
| # Use experimental buildkit for faster builds | ||
| # https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md | ||
| # Use `--progress=plain` to use plane stdout for docker build | ||
| # | ||
| # Example build command: | ||
| # This determines which version of the ROS2 code base to pull | ||
| # export ROS2_BRANCH=main | ||
| # export DOCKER_BUILDKIT=1 | ||
| # docker build \ | ||
| # --tag nav2:source \ | ||
| # --file source.Dockerfile ../ | ||
| # | ||
| # Omit the `--no-cache` if you know you don't need to break the cache. | ||
| # We're only building on top of a ros2 devel image to get the basics | ||
| # prerequisites installed such as the apt source, rosdep, etc. We don't want to | ||
| # actually use any of the ros release packages. Instead we are going to build | ||
| # everything from source in one big workspace. | ||
|
|
||
| ARG FROM_IMAGE=osrf/ros2:devel | ||
| ARG UNDERLAY_WS=/opt/underlay_ws | ||
| ARG OVERLAY_WS=/opt/overlay_ws | ||
|
|
||
| # multi-stage for caching | ||
| FROM $FROM_IMAGE AS cacher | ||
|
|
||
| # clone ros2 source | ||
| ARG ROS2_BRANCH=master | ||
| ARG ROS2_REPO=https://github.com/ros2/ros2.git | ||
| WORKDIR $ROS2_WS/src | ||
| RUN git clone $ROS2_REPO -b $ROS2_BRANCH && \ | ||
| vcs import ./ < ros2/ros2.repos && \ | ||
| find ./ -name ".git" | xargs rm -rf | ||
|
|
||
| # clone underlay source | ||
| ARG UNDERLAY_WS | ||
| WORKDIR $UNDERLAY_WS/src | ||
| COPY ./tools/underlay.repos ../ | ||
| RUN vcs import ./ < ../underlay.repos && \ | ||
| find ./ -name ".git" | xargs rm -rf | ||
|
|
||
| # copy overlay source | ||
| ARG OVERLAY_WS | ||
| WORKDIR $OVERLAY_WS/src | ||
| COPY ./ ./ros-planning/navigation2 | ||
| RUN colcon list --names-only | cat > ../packages.txt | ||
|
|
||
| # remove skiped packages | ||
| WORKDIR /opt | ||
| RUN find ./ \ | ||
| -name "AMENT_IGNORE" -o \ | ||
| -name "CATKIN_IGNORE" -o \ | ||
| -name "COLCON_IGNORE" \ | ||
| | xargs dirname | xargs rm -rf || true && \ | ||
| colcon list --paths-only \ | ||
| --packages-skip-up-to \ | ||
| $(cat $OVERLAY_WS/packages.txt | xargs) \ | ||
| | xargs rm -rf | ||
|
|
||
| # copy manifests for caching | ||
| RUN mkdir -p /tmp/opt && \ | ||
| find ./ -name "package.xml" | \ | ||
| xargs cp --parents -t /tmp/opt | ||
|
|
||
| # multi-stage for building | ||
| FROM $FROM_IMAGE AS builder | ||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # edit apt for caching | ||
| RUN cp /etc/apt/apt.conf.d/docker-clean /etc/apt/ && \ | ||
| echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ | ||
| > /etc/apt/apt.conf.d/docker-clean | ||
|
|
||
| # install packages | ||
| RUN --mount=type=cache,target=/var/cache/apt \ | ||
| --mount=type=cache,target=/var/lib/apt \ | ||
| apt-get update && apt-get install -q -y \ | ||
| ccache \ | ||
| libasio-dev \ | ||
| libtinyxml2-dev \ | ||
| && rosdep update | ||
|
|
||
| ENV ROS_VERSION=2 \ | ||
| ROS_PYTHON_VERSION=3 | ||
|
|
||
| # install ros2 dependencies | ||
| WORKDIR $ROS2_WS | ||
| COPY --from=cacher /tmp/$ROS2_WS ./ | ||
| COPY ./tools/skip_keys.txt /tmp/ | ||
| RUN --mount=type=cache,target=/var/cache/apt \ | ||
| --mount=type=cache,target=/var/lib/apt \ | ||
| apt-get update && rosdep install -q -y \ | ||
| --from-paths src \ | ||
| --ignore-src \ | ||
| --skip-keys " \ | ||
| $(cat /tmp/skip_keys.txt | xargs) \ | ||
| " | ||
|
|
||
| # build ros2 source | ||
| COPY --from=cacher $ROS2_WS ./ | ||
| ARG ROS2_MIXINS="release ccache" | ||
| RUN --mount=type=cache,target=/root/.ccache \ | ||
| colcon build \ | ||
| --symlink-install \ | ||
| --mixin $ROS2_MIXINS | ||
|
|
||
| # install underlay dependencies | ||
| ARG UNDERLAY_WS | ||
| WORKDIR $UNDERLAY_WS | ||
| COPY --from=cacher /tmp/$UNDERLAY_WS ./ | ||
| RUN --mount=type=cache,target=/var/cache/apt \ | ||
| --mount=type=cache,target=/var/lib/apt \ | ||
| . $ROS2_WS/install/setup.sh && \ | ||
| apt-get update && rosdep install -q -y \ | ||
| --from-paths src \ | ||
| $ROS2_WS/src \ | ||
| --ignore-src \ | ||
| --skip-keys " \ | ||
| $(cat /tmp/skip_keys.txt | xargs) \ | ||
| " | ||
|
|
||
| # build underlay source | ||
| COPY --from=cacher $UNDERLAY_WS ./ | ||
| ARG UNDERLAY_MIXINS="release ccache" | ||
| RUN --mount=type=cache,target=/root/.ccache \ | ||
| . $ROS2_WS/install/setup.sh && \ | ||
| colcon build \ | ||
| --symlink-install \ | ||
| --mixin $UNDERLAY_MIXINS | ||
|
|
||
| # install overlay dependencies | ||
| ARG OVERLAY_WS | ||
| WORKDIR $OVERLAY_WS | ||
| COPY --from=cacher /tmp/$OVERLAY_WS ./ | ||
| RUN --mount=type=cache,target=/var/cache/apt \ | ||
| --mount=type=cache,target=/var/lib/apt \ | ||
| . $UNDERLAY_WS/install/setup.sh && \ | ||
| apt-get update && rosdep install -q -y \ | ||
| --from-paths src \ | ||
| $ROS2_WS/src \ | ||
| $UNDERLAY_WS/src \ | ||
| --ignore-src \ | ||
| --skip-keys " \ | ||
| $(cat /tmp/skip_keys.txt | xargs) \ | ||
| " | ||
|
|
||
| # build overlay source | ||
| COPY --from=cacher $OVERLAY_WS ./ | ||
| ARG OVERLAY_MIXINS="release ccache" | ||
| RUN --mount=type=cache,target=/root/.ccache \ | ||
| . $UNDERLAY_WS/install/setup.sh && \ | ||
| colcon build \ | ||
| --symlink-install \ | ||
| --mixin $OVERLAY_MIXINS | ||
|
|
||
| # restore apt for docker | ||
| RUN mv /etc/apt/docker-clean /etc/apt/apt.conf.d/ && \ | ||
| rm -rf /var/lib/apt/lists/ | ||
|
|
||
| # source overlay from entrypoint | ||
| ENV UNDERLAY_WS $UNDERLAY_WS | ||
| ENV OVERLAY_WS $OVERLAY_WS | ||
| RUN sed --in-place \ | ||
| 's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \ | ||
| /ros_entrypoint.sh | ||
|
|
||
| # test overlay build | ||
| ARG RUN_TESTS | ||
| ARG FAIL_ON_TEST_FAILURE=Ture | ||
| RUN if [ -n "$RUN_TESTS" ]; then \ | ||
| . $OVERLAY_WS/install/setup.sh && \ | ||
| colcon test \ | ||
| --mixin $OVERLAY_MIXINS \ | ||
| && colcon test-result \ | ||
| || ([ -z "$FAIL_ON_TEST_FAILURE" ] || exit 1) \ | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.