Merge pull request #1100 from TimoRoth/extra_bargs

Add command line option to pass extra build args
pull/1106/head
Yuvi Panda 2021-12-17 14:52:06 +05:30 zatwierdzone przez GitHub
commit 4aa1d154a1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 25 dodań i 5 usunięć

Wyświetl plik

@ -212,6 +212,14 @@ def get_argparser():
default=[],
)
argparser.add_argument(
"--build-arg",
dest="build_args",
action="append",
help="Extra build arg to pass to the build process, in form name=value",
default=[],
)
argparser.add_argument("--subdir", type=str, help=Repo2Docker.subdir.help)
argparser.add_argument(
@ -255,11 +263,12 @@ def make_r2d(argv=None):
r2d.appendix = args.appendix
for l in args.labels:
if "=" in l:
key, val = l.split("=", 1)
r2d.labels[key] = val
else:
r2d.labels[l] = ""
key, _, val = l.partition("=")
r2d.labels[key] = val
for a in args.build_args:
key, _, val = a.partition("=")
r2d.extra_build_args[key] = val
r2d.repo = args.repo
r2d.ref = args.ref

Wyświetl plik

@ -248,6 +248,15 @@ class Repo2Docker(Application):
config=True,
)
extra_build_args = Dict(
{},
help="""
Extra build args to pass to the image build process.
This is pretty much only useful for custom Dockerfile based builds.
""",
config=True,
)
json_logs = Bool(
False,
help="""
@ -777,6 +786,8 @@ class Repo2Docker(Application):
}
if self.target_repo_dir:
build_args["REPO_DIR"] = self.target_repo_dir
build_args.update(self.extra_build_args)
self.log.info(
"Using %s builder\n",
bp.__class__.__name__,