diff --git a/hack/build-image b/hack/build-image index 1c8a3db..5f8251a 100755 --- a/hack/build-image +++ b/hack/build-image @@ -219,17 +219,25 @@ def container_build(cli, target): # --arch is not provided. So if the target arch and the host_arch # are the same, skip passing the extra argument. args.append(f"--arch={target.arch}") + run(cli, args + create_common_container_engine_args(cli, target), check=True) + +def create_common_container_engine_args(cli, target): + args = [] + pkgs_from = PACKAGES_FROM[target.pkg_source] + if pkgs_from: + args.append(f"--build-arg=INSTALL_PACKAGES_FROM={pkgs_from}") + if cli.extra_build_arg: args.extend(cli.extra_build_arg) + for tname in target.all_names(baseless=cli.without_repo_bases): args.append("-t") args.append(tname) + args.append("-f") args.append(target_containerfile(target)) args.append(kind_source_dir(target.name)) - args = [str(a) for a in args] - run(cli, args, check=True) - + return [str(a) for a in args] def container_push(cli, push_name): """Construct and execute a command to push a container image."""