diff --git a/BUILD b/BUILD index eee553a..d67189f 100644 --- a/BUILD +++ b/BUILD @@ -23,13 +23,7 @@ go_binary( visibility = ["//visibility:public"], ) -container_bundle( - name = "alpine", - images = {"base": "@alpine//image"}, -) - rootfs( - name = "alpine-rootfs1", - src = ":alpine.tar", - output = "alpine-rootfs.tar", + name = "alpine-rootfs", + src = "@alpine//image:image", ) diff --git a/rules.bzl b/rules.bzl index 539ad51..25e9e56 100644 --- a/rules.bzl +++ b/rules.bzl @@ -1,30 +1,26 @@ def _rootfs_impl(ctx): - output = ctx.outputs.output + outf = ctx.attr.name + ".tar" + out = ctx.actions.declare_file(outf) ctx.actions.run( - outputs = [output], + outputs = [out], executable = ctx.files._undocker[0], arguments = [ - ctx.attr.src.path, - output.path, + "rootfs", + ctx.attr.src.files.to_list()[0].path, + outf, ], ) + return [DefaultInfo(files = depset([out]))] rootfs = rule( doc = "Generate a rootfs from a docker container image", implementation = _rootfs_impl, - outputs = { - "out": "%{name}.tar", - }, attrs = { "src": attr.label( doc = "Input container tarball", mandatory = True, allow_single_file = [".tar"], ), - "output": attr.output( - doc = "Output rootfs tarball", - mandatory = True, - ), "_undocker": attr.label( doc = "undocker cli; private and may not be overridden", cfg = "host",