Hello, am looking to write a plugin that can outpu...
# plugins
m
Hello, am looking to write a plugin that can output a dotenv file for all the docker images that have been built, Any tips or pointers on what goals/targets to use and whether this is possible. eg .dotenv The key is the docker_image target name and the value is the image_tag
Copy code
foo_bar=<http://registry.hub.docker.com/foo/bar:latest|registry.hub.docker.com/foo/bar:latest>
eg BUILD
Copy code
docker_image(
    name="foo_bar",
    registry="foo/bar",
)
eg dist/foo_bar/foo_bar.docker-info.json
Copy code
{
  "version": 1,
  "image_id": "sha256:fbf93f808541d76144181e46250c928d1bb79123fda0b2268e8b3fc61a656635",
  "registries": [
    {
      "alias": "foo",
      "address": "<http://registry.hub.docker.com|registry.hub.docker.com>",
      "repository": "foo/bar",
      "tags": [
        {
          "template": "{build_args.DEFAULT_TAG}",
          "tag": "latest",
          "uses_local_alias": false,
          "name": "<http://registry.hub.docker.com/foo/bar:latest|registry.hub.docker.com/foo/bar:latest>"
        }
      ]
    }
  ]
}
c
Getting all docker targets is already implemented, you just need to request
AllDockerImageTargets
as an arg in your rule. As for the goal, maybe implement it as codegen so it can be output with export-codegen might be most applicable of the existing goals? ref guide for adding codegen . But you might want to create your own goal following this guide
m
Do I have to create a goal, just to output the packaged docker image? Able to extend existing package goal/rules ?
c
It's about conveying meaning an using existing mechanisms. If you want this to happen for packaged docker targets, I think you could just imitate the implementation for docker's package goal