From f18fc211eee784b0768cba08a2b9e84ab68c5077 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 22 Dec 2023 15:19:35 +0900 Subject: [PATCH] first test at building base images --- .github/include/base_image_config.json | 113 ++++++++++++++++++++++-- .github/workflows/build_base_images.yml | 38 ++++---- 2 files changed, 128 insertions(+), 23 deletions(-) diff --git a/.github/include/base_image_config.json b/.github/include/base_image_config.json index 44425e45..2c540b8b 100644 --- a/.github/include/base_image_config.json +++ b/.github/include/base_image_config.json @@ -1,15 +1,114 @@ [ { "tag": "humble-ubuntu22.04", - "external_image": "ros:humble-ros-base", - "injections": {} + "external_image": "ros:humble-ros-runtime" }, + + + + + { - "tag": "cuda11.2-tensorrt8.6.0-humble-ubuntu22.04", - "external_image": "ros:humble-ros-base", + "tag": "cuda11.0-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.0.3-runtime-ubuntu20.04", "injections": { - "ros2": "humble", - "tensorrt": "nv-tensorrt-local-repo-ubuntu2204-8.6.0-cuda-12.0_1.0-1_amd64" + "ros2": "foxy" + } + }, + { + "tag": "cuda11.2-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.2.2-runtime-ubuntu20.04", + "injections": { + "ros2": "foxy" + } + }, + { + "tag": "cuda11.4-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.4.3-runtime-ubuntu20.04", + "injections": { + "ros2": "foxy" + } + }, + { + "tag": "cuda11.7-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:11.7.1-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda11.8-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda12.0-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:12.0.0-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda12.2-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + + + + + + { + "tag": "cuda11.0-cudnn8-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu20.04", + "injections": { + "ros2": "foxy" + } + }, + { + "tag": "cuda11.2-cudnn8-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04", + "injections": { + "ros2": "foxy" + } + }, + { + "tag": "cuda11.4-cudnn8-foxy-ubuntu20.04", + "external_image": "nvcr.io/nvidia/cuda:11.4.3-cudnn8-runtime-ubuntu20.04", + "injections": { + "ros2": "foxy" + } + }, + { + "tag": "cuda11.7-cudnn8-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda11.8-cudnn8-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda12.0-cudnn8-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" + } + }, + { + "tag": "cuda12.2-cudnn8-humble-ubuntu22.04", + "external_image": "nvcr.io/nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04", + "injections": { + "ros2": "humble" } } -] \ No newline at end of file +] diff --git a/.github/workflows/build_base_images.yml b/.github/workflows/build_base_images.yml index d73308cb..257265c6 100644 --- a/.github/workflows/build_base_images.yml +++ b/.github/workflows/build_base_images.yml @@ -32,6 +32,21 @@ jobs: id: docker-environment uses: "./.github/templates/docker_context" + matrix-prep: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Check out code + uses: actions/checkout@v4 + - id: set-matrix + run: | + platform=$(echo '${{ inputs.platform }}') + matrix=$(jq --arg platform "$platform" 'map( + . | select((.run_if==$platform) or (.run_if=="always")) + )' .github/include/base_image_config.json) + echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT + build: name: Build Image and Run Initial Unit Testing Suite runs-on: ubuntu-latest @@ -43,16 +58,7 @@ jobs: strategy: fail-fast: false - matrix: - include: - - tag: humble-ubuntu22.04 - external_image: ros:humble-ros-base - - tag: cuda12.0.1-humble-ubuntu22.04 - dockerfile: cuda_ros.Dockerfile - params: - UBUNTU_DISTRO: ubuntu22.04 - CUDA_VERSION: 12.0.1 - ROS_DISTRO: humble + matrix: ${{ fromJSON(needs.matrix-prep.outputs.matrix) }} steps: # Initial workflow setup @@ -76,11 +82,12 @@ jobs: username: ${{ secrets.GHCR_USER }} password: ${{ secrets.GHCR_PWD }} - - name: Build Generic Image + - name: Inject ROS2 into Image + if: $( -z "${{ matrix.injections.ros2 }}" ) uses: docker/build-push-action@v5 with: context: . - file: docker/base/${{ matrix.dockerfile }} + file: docker/base/inject_ros2.Dockerfile push: true tags: | ${{ steps.construct-registry-url.outputs.url }}_generic @@ -89,10 +96,9 @@ jobs: cache-to: type=inline builder: ${{ steps.buildx.outputs.name }} target: devel - build-args: | - UBUNTU_DISTRO=${{ matrix.params.UBUNTU_DISTRO }} - CUDA_VERSION=${{ matrix.params.CUDA_VERSION }} - ROS_DISTRO=${{ matrix.params.ROS_DISTRO }} + build-args: | + GENERIC_BASE=${{ matrix.external_image }} + ROS_DISTRO=${{ matrix.injections.ros2 }} - name: Prepare Generic Image as Monorepo Base Image uses: docker/build-push-action@v5