Variant missing when building with github workflow and dockerhub autobuild


I’m current trying to automate the building of my docker image, targeting the RaspberryPi CM4.
When I inspect a docker image I built locally on the CM4 and works on the CM4, I can see that the architecture, varient and os are set as follows:

        "Architecture": "arm64",
        "Variant": "v8",
        "Os": "linux",

I’ve tried with both automated build in dockerhub and as a github workflow and both don’t build the image with the variant, which is stopping the image being used on the CM4. Here’s my current github workflow:

name: cli

    branches: 265-make-a-docker-image-that-is-all-self-contained-for-the-mk4_ws

    runs-on: ubuntu-latest
        name: Checkout
        uses: actions/checkout@v3
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
        name: Login to Docker Hub
        uses: docker/login-action@v2
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
        name: Setup Docker buildx
        uses: docker/setup-buildx-action@v2
        name: Build and push
        uses: docker/build-push-action@v4
          context: .
          platforms: linux/arm64/v8, linux/amd64
          file: ./Dockerfile
          push: true
          tags: rossrobotics/mk4_test:github

And my Dockerfile:

ARG ros_distro=humble
FROM --platform=$BUILDPLATFORM ros:${ros_distro}

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

WORKDIR /home/$USER/mk4_ws/src
COPY . .
WORKDIR /home/$USER/mk4_ws

The github workflow completes successfully as seen below

I can run the image successfully on my PC with docker run -it rossrobotics/mk4_test:github
But when i pull the image to the CM4 and inspect the image it doesn’t have the variant which prevents it from being run

        "Architecture": "arm64",
        "Os": "linux",

Any clues as to why its not getting built with the variant? Or how i can get it to build with the variant so the image will work on the CM4

Thanks in advance :slight_smile:

For custom architectures you need hooks on Docker Hub

Like I have for my PHP images, except that I don’t build arm versions so I don’t have the --platform option in my commands: