Bazel supports downloading external dependencies by using http_archive. I realized that some of my dependencies are not packaged as tar, but exist in a docker container. On a surface it is a very similar problem, except my archive happens to be docker container instead of tar file. I started digging in how can I achieve that. The actions that are required for it to happen are following:
- container_pull image
- container_flatten image, output of this rule is tar file
- create a repository rule from local tar file, similar how it is described
here The problem with this approach is that everything except container_flatten rule can be executed on a workspace loading stage. I feel I got stuck because I don't know if it is feasible to rewrite container_flatten rule to work on workspace loading stage. I also don't know how to do that. So I appreciate any advice how I can achieve what I want or how I can write container_flatten rule myself?