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

fix: docker builds don't squash the intermediary layers #118

Closed
dperson opened this issue Mar 12, 2024 · 10 comments
Closed

fix: docker builds don't squash the intermediary layers #118

dperson opened this issue Mar 12, 2024 · 10 comments

Comments

@dperson
Copy link

dperson commented Mar 12, 2024

I try to create as few as possible anyway, but COPYs etc. creep up as the best way to handle things.

The custom layers are now showing:
custom layers needed: 24 (1.4 GB)

Compared to the previous builds with buildah:
custom layers needed: 2 (968 MB)

I do appreciate that they are a bit faster, but is there any way you can re-enable squashing? Thanks.

@xynydev
Copy link
Member

xynydev commented Mar 12, 2024

This is probably something for the CLI? @gmpinder

@gmpinder
Copy link
Member

This is probably something for the CLI? @gmpinder

I'd think both. We could add a --squash arg and have an input to allow squashing by the user

@gmpinder
Copy link
Member

The only problem I foresee is that then the entire image would have to be redownloaded cause it would end up being all in one layer. Maybe we would have to go back to using the bash based files module. Then it would be added with an ostree container commit at the end.

@gmpinder gmpinder transferred this issue from blue-build/github-action Mar 12, 2024
@xynydev
Copy link
Member

xynydev commented Mar 12, 2024

What's the benefit of squashing anyway? Layers allow for diffs, right?

@dperson
Copy link
Author

dperson commented Mar 12, 2024

Well for these uBlue OS builds in particular lots of things get copied into /tmp to be used by the RUN, when they are on different layers the "delete" doesn't do anything except make it look neater.

@gmpinder
Copy link
Member

Well for these uBlue OS builds in particular lots of things get copied into /tmp to be used by the RUN, when they are on different layers the "delete" doesn't do anything except make it look neater.

So we actually solve this by using multi-stage builds where we keep the configs and modules in a separate stage and then mount it in for each module run. So yeah I'm starting to think that we might need to bring back the bash files module to take advantage of the ostree chunks.

@dperson
Copy link
Author

dperson commented Mar 13, 2024

I personally don't view a 25-30% reduction (70-75% of original) in build time and a 50% (150% of original) increase in image size as a win... what is the goal of the change? What feature is it providing or bug is it fixing? Thanks.

@xynydev
Copy link
Member

xynydev commented Mar 13, 2024

I'm curious on what causes the built images to become so large. That certainly wasn't a foreseen consequence of switching to docker for builds. It could be the squashing, or it could be something in Docker itself that's different? #112 might be related, maybe buildah uses compression by default and Docker doesn't?

gmpinder pushed a commit that referenced this issue Mar 17, 2024
#118 (comment)
as mentioned here reverting to the bash files module simplifies the
build process (and allows for better usage of `ostree container
commit`). It also means there are less overall layers and (ideally) a
smaller image as a result. Tested locally and template generation seems
to work just fine
@gmpinder
Copy link
Member

BlueBuild no longer has custom layers. All layers are run with ostree container commit (except user created containerfile modules). Any present custom layers should be brought up with upstream image creators.

@fiftydinar
Copy link
Contributor

I use v1.3 of GitHub action, which includes v0.8.3 version of BlueBuild CLI at the moment.

I get 400MB of needed custom layers when there is nothing of packages to update & around 1GB when I do some slight updates to RPMs (2 small Gnome extensions with only some minor file changes).

I don't remember this behavior in legacy template, which used buildah.

I don't know if this behavior is due to how docker handles things in CLI or due to how upstream base image is built, but I'm just noting this as another reported behavior.

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

No branches or pull requests

4 participants