wip alpine

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent afa64b46b7
commit f8c6c68cdf
2 changed files with 9 additions and 19 deletions

10
BUILD
View File

@ -23,13 +23,7 @@ go_binary(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
container_bundle(
name = "alpine",
images = {"base": "@alpine//image"},
)
rootfs( rootfs(
name = "alpine-rootfs1", name = "alpine-rootfs",
src = ":alpine.tar", src = "@alpine//image:image",
output = "alpine-rootfs.tar",
) )

View File

@ -1,30 +1,26 @@
def _rootfs_impl(ctx): def _rootfs_impl(ctx):
output = ctx.outputs.output outf = ctx.attr.name + ".tar"
out = ctx.actions.declare_file(outf)
ctx.actions.run( ctx.actions.run(
outputs = [output], outputs = [out],
executable = ctx.files._undocker[0], executable = ctx.files._undocker[0],
arguments = [ arguments = [
ctx.attr.src.path, "rootfs",
output.path, ctx.attr.src.files.to_list()[0].path,
outf,
], ],
) )
return [DefaultInfo(files = depset([out]))]
rootfs = rule( rootfs = rule(
doc = "Generate a rootfs from a docker container image", doc = "Generate a rootfs from a docker container image",
implementation = _rootfs_impl, implementation = _rootfs_impl,
outputs = {
"out": "%{name}.tar",
},
attrs = { attrs = {
"src": attr.label( "src": attr.label(
doc = "Input container tarball", doc = "Input container tarball",
mandatory = True, mandatory = True,
allow_single_file = [".tar"], allow_single_file = [".tar"],
), ),
"output": attr.output(
doc = "Output rootfs tarball",
mandatory = True,
),
"_undocker": attr.label( "_undocker": attr.label(
doc = "undocker cli; private and may not be overridden", doc = "undocker cli; private and may not be overridden",
cfg = "host", cfg = "host",