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

Created dockerized workflow for building protobufs. #734

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

cody-littley
Copy link
Contributor

@cody-littley cody-littley commented Aug 29, 2024

Why are these changes needed?

Creates a dockerized workflow for building protobufs.

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

Signed-off-by: Cody Littley <[email protected]>
Copy link
Contributor

@pschork pschork left a comment

Choose a reason for hiding this comment

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

Can we also update the root Makefile:protoc target to use this new build approach?

@@ -0,0 +1,38 @@
FROM debian
Copy link
Contributor

Choose a reason for hiding this comment

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

Which version of debian does this actually use? For consistency reasons we should pin to a specific release. Also, as noted in lightnode docker PR, I recommend using distroless which will make the docker build faster and significantly smaller.

Copy link
Contributor Author

@cody-littley cody-littley Aug 30, 2024

Choose a reason for hiding this comment

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

Being more explicit about the exact starting image definitely makes sense. I've selected FROM golang:1.21.12-bookworm.

Working on a multi-layer docker image to reduce overall size. Will report back.

Copy link
Contributor Author

@cody-littley cody-littley Aug 30, 2024

Choose a reason for hiding this comment

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

I'm encountering difficulty trying to get this working on top of distroless. The core of the issue is that the tools required to build the protobuffs have a bunch of various dependencies, and it's notrivial to copy those all over to a clean image. Unlike the example in smallest-golang-docker-image, this is not a container where we are just trying to deploy a simple executable. We need our entire build toolchain, and that isn't packaged in a way that makes it simple to copy over.

The size of the dockerfile built on top of golang:1.21.12-bookworm is ~1gb. The size of a distroless image that just contains the go and protoc dependencies is ~0.33gb. Decently smaller, but not orders of magnitude smaller. Since this is something in the build pipeline and not something that we are going to need to ship to customers (unless they want to compile from scratch), IMO reducing the size of the container is not urgent.

Based on this information, would you be ok proceeding with this image as I currently have it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that given we are currently using this as a utility, with the committed protobufs remaining the standard of truth, I'm happy to not spend more time trying to fine-tune our choice of an image. @pschork, please let us know if you have additional thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pschork

Can we also update the root Makefile:protoc target to use this new build approach?

I plan to do this, but I am intentionally not doing it as a part of this PR. Changing the build process for everybody has the potential of being disruptive to CI pipelines and manual workflows, and I'd rather split high risk changes like that into their own PRs.

@cody-littley cody-littley merged commit 2c75d5d into Layr-Labs:master Sep 5, 2024
6 checks passed
@cody-littley cody-littley deleted the protobuf-builder branch September 5, 2024 13:01
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.

3 participants