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: Allow docker driver to properly use cache #126

Merged
merged 10 commits into from
Mar 19, 2024

Conversation

gmpinder
Copy link
Member

This fix involves creating a new function for the BuildDriver trait called build_tag_push. In order to get the proper logic in place to make use of docker buildx, I had to create a separate function that would construct the build command to include all of the tags necessary for pushing. A default implementation of build_tag_push will be used for podman and buildah which was originally from the build command's functions. Now that we have custom logic for docker builds, we can take advantage of using the GitHub cache features without having the --load arg which had a big negative effect on build times. We can now also use docker for creating local oci-archive tarballs for local rebasing. Making use of the oci-archive will require the user to create a docker-container builder as it is not supported on the standard docker builder.

https://docs.docker.com/build/exporters/oci-docker/

This fix involves creating a new function for the BuildDriver trait called build_tag_push.
In order to get the proper logic in place to make use of docker buildx, I had to create a
separate function that would construct the build command to include all of the tags necessary
for pushing. A default implementation of build_tag_push will be used for podman and buildah
which was originally from the build command's functions. Now that we have custom logic for
docker builds, we can take advantage of using the GitHub cache features without having
the --load arg which had a big effect on build times. We can now also use docker for creating
local oci-archive tarballs for local rebasing. Making use of the oci-archive will require the user to create
a docker-container builder as it is not supported on the standard docker builder.
@gmpinder gmpinder self-assigned this Mar 17, 2024
@gmpinder gmpinder linked an issue Mar 17, 2024 that may be closed by this pull request
src/commands/build.rs Outdated Show resolved Hide resolved
src/drivers.rs Outdated Show resolved Hide resolved
src/drivers.rs Outdated Show resolved Hide resolved
src/drivers/opts/build.rs Show resolved Hide resolved
@gmpinder
Copy link
Member Author

Ok I think this is ready to be looked at

@gmpinder gmpinder enabled auto-merge (squash) March 18, 2024 12:37
@gmpinder gmpinder added this to the v0.8.3 milestone Mar 19, 2024
Copy link
Contributor

@gerblesh gerblesh left a comment

Choose a reason for hiding this comment

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

lgtm

@gmpinder gmpinder disabled auto-merge March 19, 2024 20:50
@gmpinder gmpinder merged commit 7c34d0c into main Mar 19, 2024
3 checks passed
@gmpinder gmpinder deleted the 117-feat-make-use-of-github-cache-for-buildx branch March 19, 2024 20:51
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.

fix: Make use of GitHub cache with buildx
2 participants