gem5
gem5 copied to clipboard
util-docker,github: Move to Docker buildx multi-platform builds
This PR sets up multi-platform docker images for the gem5 project. In short, multi-platform docker images are docker images built for multiple platforms. Previously all our docker images were compiled to the "linux/amd64" platform (X86). If these docker images were run on another host, the Docker engine emulated the X86 platform, at considerably performance cost. With this PR the images are built to "linux/amd64", "linux/riscv64", and "linux/arm64". When the docker pull
command is run, docker will automatically obtain the right build from the registry (e.g., if running on an ARM host, docker pull
will obtain the image built to "linux/arm64").
Multi-platform builds are built using docker buildx
and the file used to specify buildx docker builds is called a bake file. This has been included in "util/dockerfiles/docker-bake.json". To avoid confusion, "util/dockerfiles/docker-compose.yaml" has been removed. "docker compose" is not the correct tool for building docker images and has poor support for multi-platform builds.
While not yet fully tested, it should be possible to run the compilation of our docker images as part of a GitHub Actions job via the ".github/workflow/docker-build.yaml" workflow. This file has been updated in this PR with hopes incorporating it.
In addition, this PR removes the following Dockerfiles from "util/dockerfiles":
- "gem5-all-min-dependencies"
- "llvm-gpu-cross-compile-riscv64"
I could find no evidence these were presently being used. The docker images built thus far will still exist on the container registry indefinitely. Removing them from "util/dockerfiles" simply means they are not officially supported or built regularly. They can be re-added easily at a later date if needed.