8000 [all] Build cross platform docker images and build linux amd64+arm64 by robskillington · Pull Request #4194 · m3db/m3 · GitHub
[go: up one dir, main page]

Skip to content

[all] Build cross platform docker images and build linux amd64+arm64 - #4194

Open
robskillington wants to merge 3 commits into
masterfrom
r/cross-platform-docker-builder
Open

robskillington wants to merge 3 commits into
masterfrom
r/cross-platform-docker-builder

Conversation

@robskillington
Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

This adds ability to build cross platform docker images for both amd64 and arm64. e.g. Running M3 on AWS Graviton instances and/or Apple M1 chips.

So far have been using this for one off builds by pushing this branch with a trailing "/build-docker" in the commit message, but opening this for longer term merging. Most of the build change comes from the .ci/build.sh script, it's possible to branch from this branch and comment out the most of the CI jobs in .buildkite/pipeline.yml add "/build-docker" to the commit messages and push it to achieve a multi-arch build of any arbitrary commit/branch/tag from the repo.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

justinhwang added a commit to m3db/ci-scripts that referenced this pull request Sep 24, 2026
build.sh used to `docker build` a single-arch image, read its ID from an
iidfile, then `docker tag` and `docker push` each tag. A multi-platform
buildx build never lands in the local daemon, so that tag/push loop has
nothing to operate on. Replace it with one `docker buildx build --push`
per image that carries every tag as a `-t` flag.

- Register QEMU binfmt handlers and create a docker-container builder
  (DOCKER_BUILDER_NAME, default m3-multi-platform-builder) if missing.
- Platforms come from DOCKER_PLATFORMS, default linux/amd64,linux/arm64.
- DRYRUN builds every platform with push=false instead of pushing.
- --provenance=false keeps the pushed index to the real platforms only.
- Replace the `docker images | grep | rmi` cleanup, which is dead under
  buildx, with `docker buildx prune` for the builder's cache.

Supersedes the build.sh change on the r/cross-platform-docker-builder
branch (m3db/m3#4194), which kept the iidfile/tag/push flow.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
justinhwang added a commit that referenced this pull request Sep 24, 2026
…ges (#4442)

* [build] Release linux/darwin arm64 binaries and multi-arch docker images

Supersedes the stale #4171 and #4194.

goreleaser:
- Add arm64 to every build's goarch so releases ship
  {linux,darwin}_{amd64,arm64} tarballs.
- Move to goreleaser v2 (image v2.18.2, `version: 2`, `--clean` instead of
  the removed `--rm-dist`, `formats:` instead of the deprecated `format:`).
  The old v1.8.3 image bundles Go 1.18 and cannot build a go 1.26 module.

Docker:
- Build stage runs on $BUILDPLATFORM and cross-compiles with
  GOOS=$TARGETOS GOARCH=$TARGETARCH, so `docker buildx --platform
  linux/amd64,linux/arm64` produces native binaries for both without
  running the Go build under QEMU. Replaces the hardcoded
  `make <svc>-linux-amd64`.
- Align the m3coordinator release image with the others (alpine 3.20).

Makefile:
- Add LINUX_ARM64_ENV and <svc>/<tool>/services/tools-linux-arm64 targets
  mirroring the existing amd64 ones.

Submodule:
- Bump .ci to m3db/ci-scripts#113, which rewrites docker/build.sh to a
  single multi-arch `docker buildx build --push` per image.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0