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

Build multiarch docker images on tag #116

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

MikeGoldsmith
Copy link
Member

@MikeGoldsmith MikeGoldsmith commented Aug 8, 2022

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.

@MikeGoldsmith MikeGoldsmith requested a review from a team as a code owner August 8, 2022 11:45
@MikeGoldsmith
Copy link
Member Author

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

@MikeGoldsmith
Copy link
Member Author

MikeGoldsmith commented Aug 15, 2022

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
Copy link
Member Author

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?

@jmacd
Copy link

jmacd commented Aug 15, 2022

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
Copy link

jmacd commented Aug 19, 2022

@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.

Copy link

@jmacd jmacd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to use the docker images built using this branch and it seems we're not quite ready to build arm64 binaries using these tools. The grpc_cpp_plugin segfaults:

# ./grpc_cpp_plugin
Segmentation fault

That was the only one of the following list that segfaults:

# ls -l *plugin*
-rwxr-xr-x    1 root     root         31352 Sep 19 17:35 grpc_cpp_plugin
-rwxr-xr-x    1 root     root         27912 Sep 19 17:35 grpc_csharp_plugin
-rwxr-xr-x    1 root     root         27384 Sep 19 17:35 grpc_node_plugin
-rwxr-xr-x    1 root     root         22736 Sep 19 17:35 grpc_objective_c_plugin
-rwxr-xr-x    1 root     root         32960 Sep 19 17:35 grpc_php_plugin
-rwxr-xr-x    1 root     root         16512 Sep 19 17:35 grpc_python_plugin
-rwxr-xr-x    1 root     root         22520 Sep 19 17:35 grpc_ruby_plugin

FROM alpine:${ALPINE_VERSION} as protoc_builder
ARG TARGETPLATFORM
RUN echo "I'm building for $TARGETPLATFORM"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RUN echo "I'm building for $TARGETPLATFORM"
RUN echo "open-telemetry/build-tools building for $TARGETPLATFORM"

@jmacd
Copy link

jmacd commented Sep 19, 2022

I was mistaken, the grpc_objective_c_plugin also segfaults.

@jmacd
Copy link

jmacd commented Sep 19, 2022

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

@lucacome
Copy link
Contributor

lucacome commented Jan 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants