-
Notifications
You must be signed in to change notification settings - Fork 6
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
Revert "build: Use different cache and output registries" #155
Conversation
This reverts commit 917a048 and fixes the comment added by efbbfb9. We need to cache from ghcr.io because otherwise the build of nextstrain/base doesn't find the layers from the just-built nextstrain/base-builder pushed to ghcr.io. Instead, it seemingly uses layers from an older nextstrain/base-builder on docker.io. My understanding is that we were always pulling caches from docker.io (_and_ ghcr.io) because docker.io is the default registry when none is specified, and we use --cache-from lines without a registry specified. See <https://bedfordlab.slack.com/archives/C01LCTT7JNN/p1683932186614689>.
This should fix the issue described by the linked Slack thread. To check, do:
Both should be 22.0.0. If base-builder is 22.0.0 and base is 21.1.0, then the bug isn't fixed. Someone else (maybe @huddlej) should check next week and merge if it looks good. |
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.
Tested as explained by @tsibley and it doesn't seem to work for me - or do I need to build first?
$ docker run --rm -it nextstrain/base-builder:branch-cache-from-ghcr.io augur --version
Unable to find image 'nextstrain/base-builder:branch-cache-from-ghcr.io' locally
branch-cache-from-ghcr.io: Pulling from nextstrain/base-builder
Digest: sha256:cb6a55e7c4bd4d9efb9f8fd6ed900d1a11f8f481096c22db794d5b2f3c9347e3
Status: Downloaded newer image for nextstrain/base-builder:branch-cache-from-ghcr.io
augur 22.0.0
$ docker run --rm -it nextstrain/base:branch-cache-from-ghcr.io augur --version
Unable to find image 'nextstrain/base:branch-cache-from-ghcr.io' locally
branch-cache-from-ghcr.io: Pulling from nextstrain/base
Digest: sha256:c50bf9fdca3b52ec43458a7d11188f8778bf12aa06a933de8be6d4cc01ca9833
Status: Downloaded newer image for nextstrain/base:branch-cache-from-ghcr.io
augur 21.1.0
Darn, I get the same result as @corneliusroemer. @tsibley and @victorlin are out this week, so we may need to continue troubleshooting on our own, Cornelius... |
Yeah, this isn't resolving the issue.
|
Looking at the test run logs for this PR, it seems like the new branch ghcr.io builder image is being pulled when building the final image. However, the COPY commands from the builder to the final image are still using the cache. This leads to my current question of how does Docker handle multiple
I'm going to try go reorder our |
717381f
to
997b702
Compare
Well, reordering did not work 😞 Instead of continuing to bang my head on this, I just removed the |
997b702
to
4470eff
Compare
Urgh, so it seems like the base-builder image is not the issue since removing the cache-from docker.io did not fix this issue. Somehow when building the final image, Docker is not detecting the changes from the final image cache. The latest push removes the cache for the final image from docker.io so it should run all of the COPY commands. |
I _think_ Docker checks for the matching cache that is provided using the correct CACHE_DATE, which will allow Docker to use the latest built builder image.
4470eff
to
b762669
Compare
I think I found the (additional) underlying problem that is leading to the weird cache. In a recent commit, the |
This reverts commit 917a048 and fixes the comment added by efbbfb9.
We need to cache from ghcr.io because otherwise the build of nextstrain/base doesn't find the layers from the just-built nextstrain/base-builder pushed to ghcr.io. Instead, it seemingly uses layers from an older nextstrain/base-builder on docker.io.
My understanding is that we were always pulling caches from docker.io (and ghcr.io) because docker.io is the default registry when none is specified, and we use --cache-from lines without a registry specified.
See https://bedfordlab.slack.com/archives/C01LCTT7JNN/p1683932186614689.
Testing