question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build cache for export step takes ~300s to complete

See original GitHub issue

I 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:open
  • Created 2 years ago
  • Reactions:12
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
barthapcommented, Feb 6, 2022

Have similar issue, but this might be caused by cache size

Repro repo here, following jobs (clean runs, no previous cache):

I’m using type=gha, mode=max, because all my Dockerfiles are multi-staged. In case of Web app, the reason is probably a huge yarn 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, with actions/cache@v2, but I have no idea if and how it is possible to share a directory between GHA and Dockerfile stages.

0reactions
BeyondEvilcommented, Oct 5, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found