-
Notifications
You must be signed in to change notification settings - Fork 585
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
Leverage docker cache #7
Comments
Is there any workaround using just this action, or maybe using https://github.com/actions/cache? |
When (and if) the following PR#17 from docker/github-actions is merged, will this help with this request? |
@2m @rickclare Already merged. You should close this issue. |
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 |
Until the action is updated, the cache-from arg can be used via the - name: build and push docker image
uses: docker/build-push-action@v1
env:
INPUT_CACHE_FROMS: myregistry/myimage
with:
...
build_args: BUILDKIT_INLINE_CACHE=1 I'm pretty sure that should work, however I haven't had much luck with it. I'm using a multi-stage build, which the cache-from docs say requires cache manifests generated by I figured this was worth mentioning in case others who find this issue are relatively new to the cache-from feature like myself 😄 |
Merged and released. You can either use |
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 Edit2: PR for utility in docker image docker-archive/github-actions#17 |
@robpc looks like you have to pull the cache_from image first. |
@princemaple That was my conclusion, but my question is how to do that with this action. |
@robpc I used another one to login, run pull, then used this one to do the build. Did the job. Not sure if there is a better way though. |
If you use another action to authenticate and pull then I am not sure why you wouldn't use that one to build and push as well. Since this comment hasn't gotten attention from the maintainers (understandable since the issue is closed), I will create a new issue requesting an example. |
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:Also the image should be pulled from the registry first.
The text was updated successfully, but these errors were encountered: