-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve docker image build time through caches #5316
Conversation
Thank you for your contribution! 🙏 We will review your PR as soon as possible. While you are waiting, make sure to:
Learn more about: |
Nice improvement! This will help for sure with local builds. Have you checked if we can integrate this with GH Caches? I mean, workflows executed on GH Hosted runners won't have anything cached. We added tasks for exporting the cache: keda/.github/workflows/main-build.yml Lines 31 to 41 in da70147
Is there any known path that we can include to cache across CI executions? |
As I understand, when we mount it using the I think the GHA compatibility is not yet there. Buildkit doesn't seem to export cache directory, and ability to control storage location requires some weird hacks. keda/.github/workflows/main-build.yml Lines 31 to 41 in da70147
I suspect bind mounts while building would be easier to pull off for these. |
Honestly, improving developer experience is mire than enough for me, as generating images is done by a CI check, where 10 minutes more or less doesn't make the difference at all. If the local experience has been improved, I think we can merge it as it is. |
/run-e2e internal |
I might have figured something out for the pipeline. Swapping the mount type before building the image might work. Something like: sed -i '/ARG GOCACHE/a ARG LOCALCACHE=/root/.cache/go-build' Dockerfile*
sed -i 's|--mount=type=cache,target=${GOCACHE}|--mount=type=bind,source=${LOCALCACHE},target=${GOCACHE}|' Dockerfile* WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice improvement
nah, don't worry @sansmoraxz . |
Cloud you resolve the Changelog conflict? then we can merge the PR 😄 |
Signed-off-by: Souyama <souyama.debnath@atos.net>
Signed-off-by: Souyama <souyama.debnath@atos.net>
a21ac67
to
0e8ce7d
Compare
Pretty much the reason I delayed adding to the changelog. Ahh well, rebased. |
/skip-e2e |
* Improve build time with build caches Signed-off-by: Souyama <souyama.debnath@atos.net> * Add to Changelog Signed-off-by: Souyama <souyama.debnath@atos.net> --------- Signed-off-by: Souyama <souyama.debnath@atos.net> Signed-off-by: anton.lysina <alysina@gmail.com>
Add build cache for incremental builds.
As per this guide we get significant performance boost for incremental builds.
Since the docker files are already in one place, I suspect that the cache is being shared. Anyway we will get a huge performance boost while building locally. Personal observations show around 5x improvements for minute changes although this may vary.
Checklist
Relates to #5313