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

[FEATURE]: Support buildkit output compression arguments #6611

Open
alexkuretz opened this issue Oct 31, 2024 · 1 comment
Open

[FEATURE]: Support buildkit output compression arguments #6611

alexkuretz opened this issue Oct 31, 2024 · 1 comment
Assignees

Comments

@alexkuretz
Copy link

alexkuretz commented Oct 31, 2024

Feature Request

Allow configuration of buildkit output compression options such as zstd
https://github.com/moby/buildkit?tab=readme-ov-file#building-a-dockerfile-with-buildctl

Background / Motivation

This could dramatically speed up pod deployment times while decreasing image size.
https://aws.amazon.com/blogs/containers/reducing-aws-fargate-startup-times-with-zstd-compressed-container-images/

Currently the output is hardcoded I tried setting this through spec.extraArgs but that just creates duplicate outputs and didn't work:

extraFlags: ["--output", 'type=image,compression=zstd,force-compression=true,compression-level=3']

{"msg":"Execing command in my-namespace/Pod/garden-buildkit-6f9f66dc4f-tkl2w/buildkitd: sh -c cd /garden-build/ade67c77-f2b6-458e-b102-23d8ebbd7414/my-module 
&& 'buildctl' 'build' '--frontend=dockerfile.v0' 
'--local' 'context=/garden-build/ade67c77-f2b6-458e-b102-23d8ebbd7414/my-module' 
'--local' 'dockerfile=/garden-build/ade67c77-f2b6-458e-b102-23d8ebbd7414/my-module' 
'--opt' 'filename=Dockerfile' 
'--output' 'type=image,\"name=1234567890.dkr.ecr.us-west-2.amazonaws.com/my-repo/my-module:v-b72b75b844\",push=true' 

<snip>

 '--output' 'type=image,compression=zstd,force-compression=true,compression-level=3'","section":"build.my-module             →","timestamp":"2024-10-30T22:28:01.748Z","level":"debug"}

Build seemed successful and image was smaller, but got an error on deploy:

10m (x4 over 12m)      Warning   Failed              Pod/my-module-67dfc7d49d-96ksq            Failed to pull image
"1234567890.dkr.ecr.us-west-2.amazonaws.com/my-namespace/my-module:v-b72b75b844": failed to pull and unpack image
"1234567890.dkr.ecr.us-west-2.amazonaws.com/my-namespace/my-module:v-b72b75b844": number of layers and diffIDs don't match: 26 != 51

What should the user be able to do?

Define compression options on the buildkit output

Why do they want to do this? What problem does it solve?

Faster pod spinup, smaller images, multithreaded compression, probably more

Suggested Implementation(s)

Maybe add spec.outputOptions that get pushed onto the output command?

How important is this feature for you/your team?

🌵 Not having this feature makes using Garden painful
somewhere in here
🌹 It’s a nice to have, but nice things are nice 🙂

@stefreak
Copy link
Member

Thank you for the valid feature request 👍

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

No branches or pull requests

2 participants