mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Without --platform, it seems recent versions of docker ignores the platform of the image when pushing, and it's pushed as the platform of the runner. If we happen to build an arm64 image on x86, with recent version of docker, the image will be push as if it was an x86 image, then `docker run --platform=linux/arm64 ...` fails. Even if it would work without --platform, gitlab-runner will not be able to use the image. To go back to the previous behavior, we will extract --platform from the dockerfiles, and use it on the command line. --platform= is needed on both docker-build and docker-push. The first one so that the image is tagged with the right platform, and the second one so that we can push a "generic" image without been tagged to a particular platform. --platform on docker-push allow to easly use the container on any arch, without having to use --platform on docker-pull or docker-run. `docker push --platform` seem to have been added to 1.46, according to the [doc], and doesn't exist on Podman. So we need to check that we are using `docker` and that the API version is new enough. [doc] https://docs.docker.com/reference/cli/docker/image/push/ Also, introduce the $img variable, to make the lines a bit shorter. Signed-off-by: Anthony PERARD <anthony.perard@vates.tech> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>