-
Notifications
You must be signed in to change notification settings - Fork 43
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
Devcontainer Cache w/GitHub Actions Not Working? #173
Comments
This may be due to some sort of Docker caching issue when features are used. This is described in devcontainers/cli#153 . A PR was merged for a workaround that should be getting released with the next version of the CLI and then be picked up by the Action. |
A few notes:
Generally what I've been doing personally is that I have a dev container config that is for pre-creating an image, then another one that just references the image that I use to run. You can use cacheFrom instead to speed up the build process, but that was impacted by devcontainers/cli#153 in some cases per my original reply. @stuartleeks may have other tips. |
Thanks, so I can use |
Yep - you can add them now, and they should help. The only thing that might happen is that some of the layers aren't cached near term - but should happens less (if at all) on Linux where Actions workflows run. So things may work as expected already. |
So I did a few changes and things got slower. Could it be that a commit to main which triggers a rebuild of the dev container blows it away before it could be used. Other thoughts? rails-lambda/crypteia@482fa89 |
Yeah, there's a few things that could be going on:
Any of that help? If you point me to the workflow for the |
FYI - the cache fix is in the CI action, the dev container CLI, and the VS Code Dev Containers extension. It should also land in Codespaces soon. |
Cool, I'm seeing it working now with something like this. I realize the push was not needed there, but this works.
Want to close this issue? |
Sure! Glad you were unblocked! We updated docs a bit here as well given what you hit. |
I finally put this to use (https://github.com/customink/dnd-demo/blob/main/.github/workflows/test.yml) and I love it. I have a step that does that push always with imageName and cacheFrom:
Then each step afterward does this.
And I get the desired output using all the building blocks GitHub Actions provides. Thank you! |
I'm trying to get this to work on my project as well. We have a docker-compose devcontainer setup and it unfortunately seems to rebuild the features every time. I've been trying to shave down our build time as the devcontainer build accounts for a pretty good chunk of it right now. |
I have an open source project (https://github.com/customink/crypteia) I use Codespaces with. Prebuilds are tuned on (https://github.com/customink/crypteia/pkgs/container/crypteia-devcontainer) and I have the GitHub Action set (https://github.com/customink/crypteia/blob/main/.github/workflows/test.yml#L30) to use the same devcontainer. No matter what, the Actions will take many minutes vs use the devcontainer. From the logs I can see it rebuilding again and trying to push afterward and finding out the image is already present. What could keep this from working or is it expected that it will not pull the image and it always builds it?
The text was updated successfully, but these errors were encountered: