Build cache for export step takes ~300s to complete
See original GitHub issueI followed the docs here to use caching in my actions, but my job takes an extremely long time (300s on average) to prepare and export build cache to GitHub. Is there a reason the caching takes so long?
YAML file:
build-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push API
uses: docker/build-push-action@v2
with:
context: .
tags: |
ghcr.io/<registry_name>/api:${{ github.event.release.tag_name }}
ghcr.io/<registry_name>/api:latest
build-args: |
APP=api
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Optimizing builds with cache management
Each stage completes a step in the build process, and you can bridge the different stages to create your final image at the...
Read more >Best practices for speeding up builds - Google Cloud
Best practices for speeding up builds · On this page · Building leaner containers · Using Kaniko cache · Using a cached Docker...
Read more >Sonarcloud scan with monorepo(Angular UI) taking more than ...
How long does the build take if you remove the sonarcloud-scan pipe? ... caches: - node - sonar script: - npm ci --quiet...
Read more >Option for build cache to be copied or ZIP stored to save time
The project is quite large, and cache restoring/archiving is taking a while. I checked, and there are around 6GB of files cached (Unity's ......
Read more >Configuring Varnish for Magento
Luckily Magento has built-in caching mechanisms and the full page cache ... This tutorial is a step-by-step guide on how to configure Varnish...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have similar issue, but this might be caused by cache size
Repro repo here, following jobs (clean runs, no previous cache):
Example Server job run - actual build: 1min 20s, cache export: ~2min 30s (~90s preparing for export) - this is more or less acceptable dockerfile, ci workflow
Example Web app job run - actual build: 5min, cache export: ~9 min (~8 min preparing for export) - the cache is useless here, it takes almost twice as long as actual clean build dockerfile, ci workflow
I’m using
type=gha, mode=max
, because all my Dockerfiles are multi-staged. In case of Web app, the reason is probably a hugeyarn cache dir
(~1.5 GB) which is copied between stages. An ideal solution would be to mount this as external volume, since this is actually used in other non-docker workflows too, withactions/cache@v2
, but I have no idea if and how it is possible to share a directory between GHA and Dockerfile stages.@barthap This was my thinking too (external volume mount), theoretically that shouldn’t be a problem or even difficult, but the question is how to turn off the cache export step.
ETA: We use self-hosted Github Actions runners.