Allow filter out user-defined images
InfluxOW opened this issue · comments
I use docker/build-push-action
to build and cache some images so I'd like to use your action to cache only images that's not already in the docker/build-push-action
cache (only images that doesn't require build such as Elasticsearch, Redis, Database). Currently I have these images in both caches that is not good.
Would be nice to have something like this in action config:
with:
exclude-images: image1:latest, image2:2.0
Should not be difficult to do due to most of the work done in #98.
I am guessing you aren't able to simply call docker/build-push-action
before calling ScribeMD/docker-cache
?
Nah, it works fine. The only issue I see is double caching.
You could take a look at my CI to better understand the problem.
Here's CI run on empty cache. As you can see docker/build-push-action
done it's job fine. And ScribeMD/docker-cache
found no cache which is also fine and expected. But in ScribeMD/docker-cache
POST action the image that is built and cached in docker/build-push-action
is cached again (it's name encrypted via Github Actions env variables so it looks like ***:latest
).
And here's CI run after that with warmed up cache. At this place docker/build-push-action
has prepared built image layers cache and ScribeMD/docker-cache
has loaded this image from its cache.
So I'd like to manually remove image built with docker/build-push-action
from the list of images that ScribeMD/docker-cache
saves to its cache. Adding some kind of action's option would be the simplest solution so I suggested this.
Thank you for the additional details. I would try adding load: true
to docker/build-push-action
since ScribeMD/docker-cache
already filters out the images that are present before it is run. As you can see from its output in the cache miss case, the built image is not found during the main step but is found during the post step.
Thanks for the advice! Now it works fine. I had to split my docker/build-push-action
single action in two different ones like in this example. Otherwise you can't use both push
and load
options.
But in the end caching pulled images is still slower than pulling them... At least in my case. I hope at some point with some amount of images it changes so I can use this action sometime later!
Oh, where are you pulling the images that are being cached with ScribeMD/docker-cache
from? If you are able to pull from the GitHub Container Registry, that will perform the fastest in GitHub Actions.