From ab8bbf56ecdacbabae89f56f4bc8b6ea1d7bf0df Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Sat, 25 May 2024 09:29:28 +0900 Subject: [PATCH] feat(ci): enable Docker build cache to 5 times faster container build (#4730) * introduce src-imported stage Signed-off-by: Yutaka Kondo * empty Signed-off-by: Yutaka Kondo * generate install package lists * append || true Signed-off-by: Yutaka Kondo * cat packages Signed-off-by: Yutaka Kondo * chore(docker): separate `rosdep install` and `colcon build` RUN commands (#4719) * wip Signed-off-by: Yutaka Kondo * wip Signed-off-by: Yutaka Kondo * Update Dockerfile * Update Dockerfile * install pacmod * rename * Revert "install pacmod" This reverts commit ebff10f4747489da490fa54497c2722fdec91def. * install pacmod3 * register pamod3 repos * ignore hadolint * revert * run set-dev-env.sh * pip install * copy * rosdep update * vcs import outside dockerfile Signed-off-by: Yutaka Kondo * enable docker build cache Signed-off-by: Yutaka Kondo * empty Signed-off-by: Yutaka Kondo * add no-cuda/cuda suffix Signed-off-by: Yutaka Kondo * remove --download-artifacts Signed-off-by: Yutaka Kondo * remove --download-artifacts Signed-off-by: Yutaka Kondo * add --data-path option Signed-off-by: Yutaka Kondo * wip Signed-off-by: Yutaka Kondo * run download_artifacts Signed-off-by: Yutaka Kondo * remove todo Signed-off-by: Yutaka Kondo * revert run Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .github/workflows/build-main-self-hosted.yaml | 2 ++ .github/workflows/build-main.yaml | 2 ++ .github/workflows/docker-build-and-push-main-self-hosted.yaml | 2 ++ .github/workflows/docker-build-and-push-main.yaml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index c0bba91845b..9c40bcfd5b2 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -57,6 +57,8 @@ jobs: *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }} + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64 tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: false diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index 4b276a7ad32..1fff60ce250 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -52,6 +52,8 @@ jobs: *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }} + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64 tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: false diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 98b194f5d76..ff5ae7a16c6 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -85,6 +85,8 @@ jobs: *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }} + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64 tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: true diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index 729f7e9297a..ee132df8666 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -80,6 +80,8 @@ jobs: *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }} + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64 tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: true