build-tools icon indicating copy to clipboard operation
build-tools copied to clipboard

Build multiarch docker images on tag

Open MikeGoldsmith opened this issue 3 years ago • 8 comments

Updates the github workflow to use standard docker actions to build and publish multi-arch images when a git tag is pushed.

The workflow creates two tags, latest and one that is the git tag with the leading v stripped off. For example, the tag v1.2.3 would create an image with tags latest and 1.2.3.

  • Closes #115
  • Closes https://github.com/open-telemetry/opentelemetry-proto-go/issues/77

MikeGoldsmith avatar Aug 08 '22 11:08 MikeGoldsmith

Okay, fixed the docker pathing issue. Now it's failing on installing protoc_gen_lint here - this runs fine locally for me.

MikeGoldsmith avatar Aug 09 '22 17:08 MikeGoldsmith

Okay, so I've confirmed that the TARGETARCH build arg isn't getting set by the buildx command as expected - see here.

I'm working on a way to detect the target arch and set the arg another way.

This works when run and setting the build arg manually like this docker build protobuf/. -t build-tools --build-arg TARGETARCH=arm64.

MikeGoldsmith avatar Aug 15 '22 11:08 MikeGoldsmith

Well, it looks like the problem was that the generic top level ARG default was overriding the ones passed in. After removing, it seems to have worked. However, the build is now super at more than 2 hours. This is likely because we're using QEMU and compiling our own grpc binaries.

Maybe we could source prebuilt binaries from somewhere else?

MikeGoldsmith avatar Aug 15 '22 13:08 MikeGoldsmith

I'm not sure what we should do. Practically speaking, it's easy enough for me to find an amd64 machine to build with. 🤣

jmacd avatar Aug 15 '22 16:08 jmacd

@MikeGoldsmith do you mean that the build time is 2 hours to build the docker images? That doesn't sound like a problem, and it would be great to get this merged.

jmacd avatar Aug 19 '22 22:08 jmacd

I was mistaken, the grpc_objective_c_plugin also segfaults.

jmacd avatar Sep 19 '22 19:09 jmacd

How to repeat the results quoted above:

In this branch, I ran:

docker build protobuf/. -t build-tools --build-arg TARGETARCH=arm64 
docker tag build-tools:latest build-tools:multiarch

Then, in an otel-proto repository:

make OTEL_DOCKER_PROTOBUF=build-tools:multiarch

jmacd avatar Sep 19 '22 20:09 jmacd

I was about to open a similar PR (didn't notice this one)...is anybody still working on this one?

lucacome avatar Jan 06 '23 12:01 lucacome