tilt icon indicating copy to clipboard operation
tilt copied to clipboard

Allow `local_resource` to depend on `docker_build` output

Open adamf opened this issue 2 years ago • 2 comments

Describe the Feature You Want

I'd like to have a local resources that does something on the completion of the docker build phase. In my case, it would be another local resource that pushes the built image to a remote registry.

Right now we can't do that because we can't tell a resource to depend on a docker build.

Current Behavior

Nothing, you can't do this.

Why Do You Want This?

I want to have a step that pushes to a remote registry for caching purposes. Plus, there's a world in which being able to front-load the docker build graph completion before starting some/all services makes sense.

Additional context Add any other context or screenshots about the feature request here.

adamf avatar Apr 06 '22 19:04 adamf

Hi @adamf, thanks for filing this issue! Just want to make sure I understand the use case:

So, you want to have an automated process where, whenever Docker images are built, a parallel local_resource will push those built images to a remote registry for caching purposes.

The solution described here is for local_resource to be dependent on the docker build step for the given resources.

There are other ways to have Tilt push built images to your remote registry. (As @nicks described, “You could have an extension that, when you click a button, uploads all your images to the cache registry — reading them from ImageMap or DockerImage — and updates the --cache_from flag for the new images.”)

But, perhaps there is a preference for doing this with local_resource? (e.g., status is more visible in the UI, you can trigger it ad hoc, you can set manual/auto)

hyu avatar Apr 07 '22 20:04 hyu

@hyu The preference for local resource is that we can make sure we build all images and push them remotely without needing to depend on any k8s resources. I don't want to have to click a button - I want to tilt up and know that all my docker images will be build and they will be pushed to the remote registry. This way, others who pull my branch will automatically pull down the images since they're already built, instead of having to rebuild them.

adamf avatar Apr 07 '22 20:04 adamf