From f8c6c68cdf3b1c8444c8c43724510cf17e259300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 24 May 2021 00:11:58 +0300 Subject: [PATCH] wip alpine --- BUILD | 10 ++-------- rules.bzl | 18 +++++++----------- 2 files changed, 9 insertions(+), 19 deletions(-) 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",