Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util-docker,github: Move to Docker buildx multi-platform builds #1019

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

BobbyRBruce
Copy link
Member

@BobbyRBruce BobbyRBruce commented Apr 14, 2024

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":

  1. "gem5-all-min-dependencies"
  2. "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.

@BobbyRBruce BobbyRBruce added util-docker Docker util files. That found in "utils/docker" github gem5 files necessary for GitHub integration. Found in ".github" labels Apr 14, 2024
@BobbyRBruce BobbyRBruce marked this pull request as ready for review April 14, 2024 01:35
@BobbyRBruce BobbyRBruce changed the title util-docker,github: Migrates to Docker buildx multiplatform builds util-docker,github: Move to Docker buildx multi-platform builds Apr 14, 2024
JSON is a much better supported format than HCL.

Change-Id: Ieb82b8a5ff71f57502d926b9418274cbd5a1fe2a
As we wish to support multi-platform builds, docker-compose.yaml has
been replaced in favor of docker-bake.json.

Change-Id: I170ca43bcaca6412773df8f3748f324d2e8da823
This update informs the user how to build using `docker buildx`.

Change-Id: I9f15379a9b309f51654aa542f59954639ff653e6
Change-Id: I4ffad85f291d00149f8f67192e453a9ee65e0240
This does not appear to be used and therefore should not be regularly
rebuilt. The images already stored in the registry will remain
available.

Change-Id: Ie9e4dda82d32f4403b9e64a34aba540a5b885be9
This does not appear to be used by the project and therefore should not
be regularly rebuilt and uploaded to our registry. Images already on the
registry shall remain.

Change-Id: I22c4ea5ced7428912eed2d2b5f0e1960702da5ea
Now 22.04 is compiled using buildx with multi-platform, we can reference
this image directly and remove the need for duplication of the
Dockerfile.

Change-Id: Id6a8459bc0eedaea2ed94002ee9cbd812ee72b1f
* Ups the action versions where possible.
* Improves the comments.
* Corrects indentation.
* bake-action Action references "docker-bake.json" instead of
  "docker-bake.hcl".
* artifact downloaded to "downloaded-dockerfiles" dir.

Change-Id: I21b304637856f2faa213b56be12634b339b7576c
@BobbyRBruce BobbyRBruce marked this pull request as draft April 16, 2024 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github gem5 files necessary for GitHub integration. Found in ".github" util-docker Docker util files. That found in "utils/docker"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant