wip alpine
This commit is contained in:
parent
afa64b46b7
commit
f8c6c68cdf
10
BUILD
10
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",
|
||||
)
|
||||
|
18
rules.bzl
18
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",
|
||||
|
Loading…
Reference in New Issue
Block a user