redpanda-data / kminion

KMinion is a feature-rich Prometheus exporter for Apache Kafka written in Go. It is lightweight and highly configurable so that it will meet your requirements.
MIT License
620 stars 122 forks source link

Build multi-arch Docker image #139

Closed solsson closed 2 years ago

solsson commented 2 years ago

Based on https://medium.com/@tonistiigi/faster-multi-platform-builds-dockerfile-cross-compilation-guide-part-1-ec087c719eaf

A sample image built on Mac M1 with Docker Desktop is at https://hub.docker.com/r/solsson/kafka-consumers-prometheus. The build command can, I think, list any platforms supported by golang.

docker buildx build --platform=linux/amd64,linux/arm64/v8 -t solsson/kafka-consumers-prometheus --push .

I've tested the image on k3s running on Ubuntu ARM.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

weeco commented 2 years ago

Hey @solsson , good to hear from you! Thank you for the PR. I'm a bit hesitant to merge it right now, because I'm unsure how it would affect the existing build pipelines (e.g. unsure if we use buildkit), so I'll have a look and get back to this.

solsson commented 2 years ago

Agreed. It affects workflows quite significantly, in particular buildx can no longer do --load.

weeco commented 2 years ago

@solsson I updated the build pipelines and also added a build for arm64 :-). Does that work for you?

Image can be found here: https://hub.docker.com/r/vectorized/kminion/tags

image

solsson commented 2 years ago

Great!