-
We’re currently building a Docker image every workflow run. This takes 10-15 minutes. It’s faster to fetch the same image from Docker hub, but nicer to only be dependent on the Dockerfile in the repo. Is there any way to speed up subsequent builds by doing some kind of Docker build caching? |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 1 reply
-
We’re adding caching. It will arrive by mid-November. |
Beta Was this translation helpful? Give feedback.
-
For those who found this Subject looking for a way to use cache in Workflows, you can use this action that does just what @nergnezor mentioned: fetches the layers from a Registry and use (multiple) –cache-from to hint docker where to look for cache. The action supports multi-stage builds as it pushes each stage to a registry, and pull them when a new build is triggered. This is a minimal example:
|
Beta Was this translation helpful? Give feedback.
-
Using buildx and ghaction-docker-buildx does not require to set cache or to push to registry:
Live example: https://github.com/crazy-max/swarm-cronjob/runs/231926567 |
Beta Was this translation helpful? Give feedback.
-
@ethomson Given https://github.com/actions/cache is on, does it apply to the original question? (Caching docker layers) Or is something different is coming for Docker image layer caching? |
Beta Was this translation helpful? Give feedback.
-
Also looking for an answer to this; it is mid-November |
Beta Was this translation helpful? Give feedback.
-
It’s already mid of Feb 2020, any update on this? |
Beta Was this translation helpful? Give feedback.
-
How is it cached then? |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I found a solution that works pretty well. Unfortunately doesn’t FULLY cache, so you have to do some data transfer but seems to get the job done. I run
|
Beta Was this translation helpful? Give feedback.
-
Its mid-May 2020. This still doesn’t exist and no news has been shared about when it might. |
Beta Was this translation helpful? Give feedback.
-
@ethomson Hi, im wondering if maybe theres an update on this yet? Built in docker layer caching would be great |
Beta Was this translation helpful? Give feedback.
-
See https://github.com/crazy-max/ghaction-docker-buildx#leverage-buildx-cache |
Beta Was this translation helpful? Give feedback.
-
Try this action I created. |
Beta Was this translation helpful? Give feedback.
-
How exactly to use it with Docker layers? Should I configure a step to cache/restore the dir |
Beta Was this translation helpful? Give feedback.
We’re adding caching. It will arrive by mid-November.
See also https://github.community/t5/GitHub-Actions/Caching-files-between-GitHub-Action-executions/m-p/30974#M630