From 3dd93ea596d464f8e7658223a61a24bd20bdabe0 Mon Sep 17 00:00:00 2001 From: Mikhail Gordeev Date: Fri, 10 Feb 2023 15:59:22 +0300 Subject: [PATCH] Add exclude_regexes to distoless.toml format --- build.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 873bc86..66c31f8 100755 --- a/build.py +++ b/build.py @@ -71,6 +71,7 @@ class Distroless: self.file_lists = dd.get("file-lists", []) self.files = dd.get("files", []) self.packages = dd.get("packages", []) + self.exclude_regexes = dd.get("exclude-regexes", []) self.builder_install_packages = dd.get("builder-install-packages") @@ -354,7 +355,19 @@ class DockerBuilder: + packages_options ) - run(["buildah", "run", builder, "./distroless-builder.py", "tar"]) + exclude_regexes_options = [] + if distroless.exclude_regexes: + exclude_regexes_options = ["-r"] + distroless.exclude_regexes + run( + [ + "buildah", + "run", + builder, + "./distroless-builder.py", + "tar", + ] + + exclude_regexes_options + ) run( [