-
Notifications
You must be signed in to change notification settings - Fork 55
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
Cache docker layers in CI build #628
Conversation
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.
We don't deploy using this workflow so I have no way to test this.
path: /tmp/.buildx-cache | ||
key: keri-${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
keri-${{ runner.os }}-buildx- |
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.
Is something missing from the end of this line?
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.
No, it's just a match prefix.
The reason it doesn't make sense to include the ${{ github.sha }}
value in match line (restore-keys) the line is because you only want to invalidate the Docker cache when the internals of the Docker Build command detect a change needed.
The ${{ github.sha }}
value changes on every new commit which would mean an entirely new cache folder on every commit which defeats the purpose of caching. The value you can gain with caching only comes from the intermediary Docker image layers prior to the COPY command for copying source code in.
Typically this only happens when you make a change to the Dockerfile or when something copied in with a COPY command changes.
Which workflow is used for deployment? I'll copy this over. |
I see the python-app-ci.yaml It's not too much different to integrate it into a docker build command though you do have to change it to use I see the docker build -f .github/workflows/interop/Dockerfile --no-cache -t ${{ env.GITHUB_REPOSITORY_NAME }}/keripy-interop:${{ env.CACHE_KEY_INTEROP }} . Is the |
This should speed up successive Docker image builds.