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"],
)
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",
)

View File

@ -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",