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.

Leverage docker cache

See original GitHub issue

Would it possible to add support for using docker cache?

Especially for PR validation, it would be great if it would be possible to specify a docker image that would be used for resolving layer cache. That image name would be passed to a docker build option:

--cache-from strings      Images to consider as cache sources

Also the image should be pulled from the registry first.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
zappy-shucommented, Apr 22, 2020

Note that though the backend image has been released I am still waiting on approval of the updated docs to release the action with the new input. Pushing to get this done ASAP.

Thank you for your contribution @appleboy

1reaction
robpccommented, May 8, 2020

Can we have an example of how to use this option? Looking at the go code, it just adds the option to the build command, but that will do nothing when there is no local cache (ie a CB scenario like this). In my experience you need to pull the image first, so was hoping that this change did that as well. I did some testing with this action and was unable to get it to work which was consistent with that conclusion.

- name: Docker Build
  uses: docker/build-push-action@v1
  with:
    registry: quay.io
    repository: ${{ env.quayio_repo }}
    username: ${{ env.quayio_user }}
    password: ${{ secrets.QUAY_AUTH }}
    tags: >-
      ${{ env.docker_tag }},
      ${{ env.docker_cache_tag }}
    cache_froms: ${{ env.quayio_repo }}:${{ env.docker_cache_tag }}

Edit: Tried several variations including cache_froms: quay.io/${{ env.quayio_repo }}:${{ env.docker_cache_tag }} with no success

_Edit2: PR for utility in docker image https://github.com/docker/github-actions/pull/17_

Read more comments on GitHub >

github_iconTop Results From Across the Web

Leverage the Build Cache - The Beginners Guide to Docker
Learn to use build cache to optimize image build time. ... The build process used by Docker has the concept of a cache,...
Read more >
Best practices for writing Dockerfiles - Docker Documentation
Leverage build cache . When building an image, Docker steps through the instructions in your Dockerfile , executing each in the order specified....
Read more >
Docker Cache – How to Do a Clean Image Rebuild and Clear ...
Docker's build-cache is a handy feature. It speeds up Docker builds due to reusing previously created layers. You can use the --no-cache option ......
Read more >
Fast Docker Builds With Caching (Not Only) For Python
One of our requirements was to leverage Docker cache also in CI/CD jobs which may not have local cache available. That's when external...
Read more >
Reducing Docker image size (Docker Layer Caching)
Leveraging Docker Layer Caching. Multiple images built during our CI/CD process are based on the same image. We are using Docker Layer ...
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 Reddit Thread

No results found

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