Build Docker image #15187
This file contains 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
name: "Build Docker image" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
# Run the CI automatically every day to look for flakyness. | |
- cron: '0 0 * * *' | |
jobs: | |
build_ubuntu_docker_image: | |
strategy: | |
fail-fast: false | |
matrix: | |
base_image_name: [ubuntu] | |
base_image_tag: [focal, jammy, noble] | |
name: "${{ matrix.base_image_name }}-${{ matrix.base_image_tag }}" | |
# always use latest linux worker, as it should not have any impact | |
# when it comes to building docker images. | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout repository | |
uses: actions/checkout@v4 | |
- | |
name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: | | |
BASE_IMAGE_NAME=${{ matrix.base_image_name }} | |
BASE_IMAGE_TAG=${{ matrix.base_image_tag }} | |
VCS_REF=${{ github.sha }} | |
ROS_DISTRO=none | |
tags: | | |
rostooling/setup-ros-docker:${{ matrix.base_image_name }}-${{ matrix.base_image_tag }}-latest | |
ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-${{ matrix.base_image_name }}-${{ matrix.base_image_tag }}:master | |
build_ubuntu_docker_image_ros: | |
strategy: | |
fail-fast: false | |
matrix: | |
base_image_name: [ubuntu] | |
ros_distro: [noetic, humble, iron, jazzy, rolling] | |
ros_variant: [desktop, ros-base] | |
include: | |
# Noetic Ninjemys (May 2020 - May 2025) | |
- ros_distro: noetic | |
base_image_tag: focal | |
ros_variant: desktop | |
rmw_implementations: | |
output_image_tag: ubuntu-focal-ros-noetic-desktop | |
- ros_distro: noetic | |
base_image_tag: focal | |
ros_variant: ros-base | |
rmw_implementations: | |
output_image_tag: ubuntu-focal-ros-noetic-ros-base | |
# Humble Hawksbill (May 2022 - May 2027) | |
- ros_distro: humble | |
base_image_tag: jammy | |
ros_variant: desktop | |
rmw_implementations: ros-humble-rmw-fastrtps-cpp,ros-humble-rmw-cyclonedds-cpp,ros-humble-rmw-connextdds | |
output_image_tag: ubuntu-jammy-ros-humble-desktop | |
- ros_distro: humble | |
base_image_tag: jammy | |
ros_variant: ros-base | |
rmw_implementations: ros-humble-rmw-fastrtps-cpp,ros-humble-rmw-cyclonedds-cpp,ros-humble-rmw-connextdds | |
output_image_tag: ubuntu-jammy-ros-humble-ros-base | |
# Iron Irwini (May 2023 - November 2024) | |
- ros_distro: iron | |
base_image_tag: jammy | |
ros_variant: desktop | |
rmw_implementations: ros-iron-rmw-fastrtps-cpp,ros-iron-rmw-cyclonedds-cpp,ros-iron-rmw-connextdds | |
output_image_tag: ubuntu-jammy-ros-iron-desktop | |
- ros_distro: iron | |
base_image_tag: jammy | |
ros_variant: ros-base | |
rmw_implementations: ros-iron-rmw-fastrtps-cpp,ros-iron-rmw-cyclonedds-cpp,ros-iron-rmw-connextdds | |
output_image_tag: ubuntu-jammy-ros-iron-ros-base | |
# Jazzy Jalisco (May 2024 - May 2029) | |
- ros_distro: jazzy | |
base_image_tag: noble | |
ros_variant: desktop | |
rmw_implementations: ros-jazzy-rmw-fastrtps-cpp,ros-jazzy-rmw-cyclonedds-cpp,ros-jazzy-rmw-connextdds | |
output_image_tag: ubuntu-noble-ros-jazzy-desktop | |
- ros_distro: jazzy | |
base_image_tag: noble | |
ros_variant: ros-base | |
rmw_implementations: ros-jazzy-rmw-fastrtps-cpp,ros-jazzy-rmw-cyclonedds-cpp,ros-jazzy-rmw-connextdds | |
output_image_tag: ubuntu-noble-ros-jazzy-ros-base | |
# Rolling Ridley (June 2020 - Ongoing) | |
- ros_distro: rolling | |
base_image_tag: noble | |
ros_variant: desktop | |
rmw_implementations: ros-rolling-rmw-fastrtps-cpp,ros-rolling-rmw-cyclonedds-cpp,ros-rolling-rmw-connextdds | |
output_image_tag: ubuntu-noble-ros-rolling-desktop | |
- ros_distro: rolling | |
base_image_tag: noble | |
ros_variant: ros-base | |
rmw_implementations: ros-rolling-rmw-fastrtps-cpp,ros-rolling-rmw-cyclonedds-cpp,ros-rolling-rmw-connextdds | |
output_image_tag: ubuntu-noble-ros-rolling-ros-base | |
name: "${{ matrix.output_image_tag }}" | |
# always use latest linux worker, as it should not have any impact | |
# when it comes to building docker images. | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout repository | |
uses: actions/checkout@v4 | |
- | |
name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: | | |
BASE_IMAGE_NAME=${{ matrix.base_image_name }} | |
BASE_IMAGE_TAG=${{ matrix.base_image_tag }} | |
EXTRA_APT_PACKAGES=ros-${{ matrix.ros_distro }}-${{ matrix.ros_variant }},${{ matrix.rmw_implementations }} | |
VCS_REF=${{ github.sha }} | |
ROS_DISTRO=${{ matrix.ros_distro }} | |
tags: | | |
rostooling/setup-ros-docker:${{ matrix.output_image_tag }}-latest | |
ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-${{ matrix.output_image_tag }}:master |