docker_image.yml•4.63 kB
name: Docker images build and push
on:
pull_request:
branches:
- main
- dev
- 'stabilization/**'
push:
branches:
- main
schedule:
- cron: '0 4 * * 0'
jobs:
build_image:
if: github.event_name == 'pull_request' || github.event_name == 'schedule'
runs-on: wisevision-runner
strategy:
matrix:
ros_distro: [humble, jazzy]
container:
image: ubuntu:22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y docker.io
- name: Docker build (${{ matrix.ros_distro }})
run: |
docker build -t ros2_mcp --build-arg ROS_DISTRO=${{ matrix.ros_distro }} .
build_and_push_arm64:
if: github.event_name == 'push'
name: Build & Push (ARM64)
runs-on: wisevision-runner
strategy:
matrix:
ros_distro: [humble, jazzy]
container:
image: ubuntu:22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y docker.io
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push ARM64 image
run: |
docker buildx build \
--platform linux/arm64 \
--file Dockerfile \
--build-arg ROS_DISTRO=${{ matrix.ros_distro }} \
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }}-arm64 \
--push \
.
build_and_push_amd64:
if: github.event_name == 'push'
name: Build & Push (AMD64)
runs-on: ubuntu-latest
strategy:
matrix:
ros_distro: [humble, jazzy]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push AMD64 image
run: |
docker buildx build \
--platform linux/amd64 \
--file Dockerfile \
--build-arg ROS_DISTRO=${{ matrix.ros_distro }} \
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }}-amd64 \
--push \
.
merge_manifests:
if: github.event_name == 'push'
name: Merge Images into Multi-Arch (Docker Hub)
runs-on: wisevision-runner
needs: [build_and_push_arm64, build_and_push_amd64]
strategy:
matrix:
ros_distro: [humble, jazzy]
container:
image: ubuntu:22.04
steps:
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y docker.io
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Merge ARM64 and AMD64 into one multi-arch tag (Docker Hub)
run: |
docker buildx imagetools create \
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }} \
${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }}-amd64 \
${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }}-arm64
docker buildx imagetools inspect ${{ secrets.DOCKER_HUB_USERNAME }}/ros2_mcp:${{ matrix.ros_distro }}
send_trigger:
if: github.event_name == 'push'
needs: [merge_manifests]
runs-on: wisevision-runner
container: ubuntu:22.04
steps:
- name: Install curl
run: |
apt-get update
apt-get install -y curl
- name: Send Repository Dispatch to wisevision.proj
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/wise-vision/mcp_server_ros_2-private/dispatches \
-d '{"event_type": "trigger-build-and-push-image"}'