diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 7e57b3f0afd..1d802e999ce 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -2,9 +2,6 @@ name: docker-build-and-push description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -14,9 +11,6 @@ inputs: build-args: description: "" required: false - tag-suffix: - description: "" - required: false dockerhub-token: description: "" required: true @@ -45,9 +39,8 @@ runs: with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get @@ -55,9 +48,8 @@ runs: with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -81,8 +73,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=base${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=base${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=base-${{ inputs.platform }} + type=raw,value=base-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-base flavor: | latest=false @@ -93,8 +85,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=core-devel-${{ inputs.platform }} + type=raw,value=core-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-core-devel flavor: | latest=false @@ -105,32 +97,56 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception-devel flavor: | latest=false + - name: Docker meta for autoware:universe-sensing-perception-devel-cuda + id: meta-universe-sensing-perception-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-devel-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe-sensing-perception id: meta-universe-sensing-perception uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception flavor: | latest=false + - name: Docker meta for autoware:universe-sensing-perception-cuda + id: meta-universe-sensing-perception-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe-localization-mapping-devel id: meta-universe-localization-mapping-devel uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping-devel flavor: | latest=false @@ -141,8 +157,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping flavor: | latest=false @@ -153,8 +169,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control-devel flavor: | latest=false @@ -165,8 +181,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control flavor: | latest=false @@ -177,8 +193,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system-devel flavor: | latest=false @@ -189,8 +205,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system flavor: | latest=false @@ -201,24 +217,48 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-devel-${{ inputs.platform }} + type=raw,value=universe-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-devel flavor: | latest=false + - name: Docker meta for autoware:universe-devel-cuda + id: meta-universe-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-devel-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe id: meta-universe uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-${{ inputs.platform }} + type=raw,value=universe-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe flavor: | latest=auto + - name: Docker meta for autoware:universe-cuda + id: meta-universe-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-cuda-${{ inputs.platform }} + type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-cuda + flavor: | + latest=auto + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -234,7 +274,9 @@ runs: ${{ steps.meta-base.outputs.bake-file }} ${{ steps.meta-core-devel.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception-devel.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} ${{ steps.meta-universe-localization-mapping-devel.outputs.bake-file }} ${{ steps.meta-universe-localization-mapping.outputs.bake-file }} ${{ steps.meta-universe-planning-control-devel.outputs.bake-file }} @@ -242,7 +284,9 @@ runs: ${{ steps.meta-universe-vehicle-system-devel.outputs.bake-file }} ${{ steps.meta-universe-vehicle-system.outputs.bake-file }} ${{ steps.meta-universe-devel.outputs.bake-file }} + ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} ${{ steps.meta-universe.outputs.bake-file }} + ${{ steps.meta-universe-cuda.outputs.bake-file }} provenance: false set: | ${{ inputs.build-args }} diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index 1fec7b76005..e6926233a72 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -2,9 +2,6 @@ name: docker-build description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -39,48 +36,44 @@ runs: - name: Cache ccache uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-ccache with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Cache apt-get uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-apt-get with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Restore ccache uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -106,4 +99,4 @@ runs: context: . push: false build-args: ${{ inputs.build-args }} - cache-from: type=registry,ref=${{ github.repository }}-buildcache:${{ inputs.name }}-${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} + cache-from: type=registry,ref=${{ github.repository }}-buildcache:${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 5448188c096..3253ee9c9dc 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204-arm - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - tag-suffix: -cuda steps: - name: Check if PR author is the specific user id: author-check @@ -74,19 +56,16 @@ jobs: (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/arm64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.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=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=aarch64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 69bb1cd60ce..17c3624a090 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204 - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - tag-suffix: -cuda steps: - name: Check if PR author is the specific user id: author-check @@ -74,19 +56,16 @@ jobs: (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/amd64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.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=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/health-check-arm64.yaml b/.github/workflows/health-check-arm64.yaml index 9ef1c8f5b61..8f71d173a52 100644 --- a/.github/workflows/health-check-arm64.yaml +++ b/.github/workflows/health-check-arm64.yaml @@ -12,22 +12,6 @@ jobs: docker-build: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204-arm - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 steps: # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace @@ -45,14 +29,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=aarch64 dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 3da9f52de8c..885342bdc6a 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -29,20 +29,6 @@ jobs: runs-on: buildjet-16vcpu-ubuntu-2204 strategy: fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 steps: - name: Check out repository uses: actions/checkout@v4 @@ -55,14 +41,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=x86_64 dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/docker/Dockerfile b/docker/Dockerfile index 82e2ccaf9e0..56c2b2b555f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,6 @@ ARG BASE_IMAGE FROM $BASE_IMAGE AS base SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS # Install apt packages and add GitHub to known hosts for private repositories RUN rm -f /etc/apt/apt.conf.d/docker-clean \ @@ -25,7 +24,7 @@ WORKDIR /autoware # Set up base environment RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module base ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache \ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc @@ -193,13 +192,12 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ FROM base AS core-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS ENV CCACHE_DIR="/root/.ccache" # Set up development environment and tools RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers openadkit \ && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache @@ -292,6 +290,47 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception-devel AS universe-sensing-perception-devel-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + # TODO(youtalk): Move CUDA related packages into a dedicated directory + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation,target=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/cuda_utils \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && colcon build --cmake-args \ + " -Wno-dev" \ + " --no-warn-unused-cli" \ + --merge-install \ + --install-base /opt/autoware \ + --mixin release compile-commands ccache \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && rm -rf /autoware/build + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-localization-mapping-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -435,18 +474,32 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-devel AS universe-devel-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-sensing-perception SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -455,8 +508,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -469,18 +521,43 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception AS universe-sensing-perception-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-localization-mapping SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-exec-depend-packages.txt /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -507,14 +584,13 @@ FROM base AS universe-planning-control SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-exec-depend-packages.txt /tmp/rosdep-universe-planning-control-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-planning-control-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -541,14 +617,13 @@ FROM base AS universe-vehicle-system SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-exec-depend-packages.txt /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -575,14 +650,13 @@ FROM base AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -591,8 +665,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -604,3 +677,29 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] + +FROM universe AS universe-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index a8d5d4e1d37..1da71481c51 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -1,414 +1,485 @@ - - - + + G - + cluster_legend - + key -FROM ...  -COPY --from=...  -RUN --mount=(.*)from=...  +FROM ...  +COPY --from=...  +RUN --mount=(.*)from=...  key2 -  -  -  +  +  +  key:e->key2:w - - + + key:e->key2:w - - + + key:e->key2:w - - + + external_image_0 - -$BASE_IMAGE + +$BASE_IMAGE stage_0 - -base + +base external_image_0->stage_0 - - + + stage_1 - -rosdep-depend + +rosdep-depend external_image_0->stage_1 - - + + stage_7 - -core-devel + +core-devel stage_0->stage_7 - - + + - + -stage_14 - -universe-sensing-perception +stage_16 + +universe-sensing-perception - + -stage_0->stage_14 - - - +stage_0->stage_16 + + - + -stage_15 - -universe-localization-mapping +stage_18 + +universe-localization-mapping - + -stage_0->stage_15 - - +stage_0->stage_18 + + - + -stage_16 - -universe-planning-control +stage_19 + +universe-planning-control - + -stage_0->stage_16 - - - - +stage_0->stage_19 + + - + -stage_17 - -universe-vehicle-system +stage_20 + +universe-vehicle-system - + -stage_0->stage_17 - +stage_0->stage_20 + + - + -stage_18 - -universe +stage_21 + +universe - + -stage_0->stage_18 - - +stage_0->stage_21 + + + + + stage_1->stage_7 - - + + stage_2 - -rosdep-universe-sensing-perception-depend + +rosdep-universe-sensing-perception-depend stage_1->stage_2 - - + + stage_3 - -rosdep-universe-localization-mapping-depend + +rosdep-universe-localization-mapping-depend stage_1->stage_3 - - + + + stage_4 - -rosdep-universe-planning-control-depend + +rosdep-universe-planning-control-depend stage_1->stage_4 - - - + + stage_5 - -rosdep-universe-vehicle-system-depend + +rosdep-universe-vehicle-system-depend stage_1->stage_5 - - + + stage_6 - -rosdep-universe-depend + +rosdep-universe-depend stage_1->stage_6 - - - + + stage_8 - -universe-common-devel + +universe-common-devel stage_1->stage_8 - - + + - + stage_7->stage_8 - - + + - - -stage_2->stage_14 - - + + +stage_17 + +universe-sensing-perception-cuda + + + +stage_16->stage_17 + + + + + +stage_22 + +universe-cuda + + + +stage_21->stage_22 + + + + + +stage_2->stage_16 + + stage_9 - -universe-sensing-perception-devel + +universe-sensing-perception-devel stage_2->stage_9 - - - - - -stage_3->stage_15 - - + + stage_10 - -universe-localization-mapping-devel + +universe-sensing-perception-cuda-devel - - -stage_3->stage_10 - - + + +stage_2->stage_10 + + + - - -stage_4->stage_16 - - + + +stage_3->stage_18 + + stage_11 - -universe-planning-control-devel + +universe-localization-mapping-devel - - -stage_4->stage_11 - - + + +stage_3->stage_11 + + - - -stage_5->stage_17 - - - + + +stage_4->stage_19 + + stage_12 - -universe-vehicle-system-devel + +universe-planning-control-devel - - -stage_5->stage_12 - - + + +stage_4->stage_12 + + - - -stage_6->stage_18 - - + + +stage_5->stage_20 + + stage_13 - -universe-devel + +universe-vehicle-system-devel - - -stage_6->stage_13 - - + + +stage_5->stage_13 + + - - -stage_8->stage_9 - - + + +stage_6->stage_21 + - + + +stage_14 + +universe-devel + + + +stage_6->stage_14 + + + + -stage_8->stage_10 - - +stage_8->stage_9 + + stage_8->stage_11 - - + + stage_8->stage_12 - - + + stage_8->stage_13 - - - - - -stage_9->stage_14 - - + + - + -stage_9->stage_13 - - +stage_8->stage_14 + + - + -stage_10->stage_15 - - +stage_9->stage_16 + + - + + +stage_9->stage_10 + + + + -stage_10->stage_13 - - +stage_9->stage_14 + + - - -stage_11->stage_16 - - + + +stage_15 + +universe-cuda-devel - + -stage_11->stage_13 - - +stage_10->stage_15 + + + + + +stage_10->stage_17 + + - + -stage_12->stage_17 - - +stage_11->stage_18 + + - + -stage_12->stage_13 - - +stage_11->stage_14 + + + + + +stage_12->stage_19 + + - + -stage_13->stage_18 - - +stage_12->stage_14 + + + + + +stage_13->stage_20 + + + + + +stage_13->stage_14 + + + + + +stage_14->stage_21 + + + + + +stage_14->stage_15 + + + + + +stage_15->stage_22 + + diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 35d0f7fdbfc..445c26a349e 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -3,7 +3,9 @@ group "default" { "base", "core-devel", "universe-sensing-perception-devel", + "universe-sensing-perception-devel-cuda", "universe-sensing-perception", + "universe-sensing-perception-cuda", "universe-localization-mapping-devel", "universe-localization-mapping", "universe-planning-control-devel", @@ -11,7 +13,9 @@ group "default" { "universe-vehicle-system-devel", "universe-vehicle-system", "universe-devel", - "universe" + "universe-devel-cuda", + "universe", + "universe-cuda" ] } @@ -19,7 +23,9 @@ group "default" { target "docker-metadata-action-base" {} target "docker-metadata-action-core-devel" {} target "docker-metadata-action-universe-sensing-perception-devel" {} +target "docker-metadata-action-universe-sensing-perception-devel-cuda" {} target "docker-metadata-action-universe-sensing-perception" {} +target "docker-metadata-action-universe-sensing-perception-cuda" {} target "docker-metadata-action-universe-localization-mapping-devel" {} target "docker-metadata-action-universe-localization-mapping" {} target "docker-metadata-action-universe-planning-control-devel" {} @@ -27,7 +33,9 @@ target "docker-metadata-action-universe-planning-control" {} target "docker-metadata-action-universe-vehicle-system-devel" {} target "docker-metadata-action-universe-vehicle-system" {} target "docker-metadata-action-universe-devel" {} +target "docker-metadata-action-universe-devel-cuda" {} target "docker-metadata-action-universe" {} +target "docker-metadata-action-universe-cuda" {} target "base" { inherits = ["docker-metadata-action-base"] @@ -47,12 +55,24 @@ target "universe-sensing-perception-devel" { target = "universe-sensing-perception-devel" } +target "universe-sensing-perception-devel-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-devel-cuda" +} + target "universe-sensing-perception" { inherits = ["docker-metadata-action-universe-sensing-perception"] dockerfile = "docker/Dockerfile" target = "universe-sensing-perception" } +target "universe-sensing-perception-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-cuda" +} + target "universe-localization-mapping-devel" { inherits = ["docker-metadata-action-universe-localization-mapping-devel"] dockerfile = "docker/Dockerfile" @@ -95,8 +115,20 @@ target "universe-devel" { target = "universe-devel" } +target "universe-devel-cuda" { + inherits = ["docker-metadata-action-universe-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-devel-cuda" +} + target "universe" { inherits = ["docker-metadata-action-universe"] dockerfile = "docker/Dockerfile" target = "universe" } + +target "universe-cuda" { + inherits = ["docker-metadata-action-universe-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-cuda" +}