add build and dt types for platfrom

This commit is contained in:
Vladislav 2024-12-13 18:15:17 +01:00
parent cb8a28c128
commit 12858d6d61
2 changed files with 26 additions and 1 deletions

View file

@ -77,6 +77,12 @@ class StackBuild(Subcommand):
default="conda",
)
self.parser.add_argument(
"--platform",
type=str,
help="Platform to use for the build. Required when using docker as image type, defaults to host if no platform is specified",
)
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
import textwrap
@ -96,6 +102,8 @@ class StackBuild(Subcommand):
available_templates = available_templates_specs()
for build_config in available_templates:
if build_config.name == args.template:
if args.platform:
build_config.platform = args.platform
if args.image_type:
build_config.image_type = args.image_type
else:
@ -130,6 +138,15 @@ class StackBuild(Subcommand):
default="conda",
)
platform = prompt(
"> Enter the target platform you want your Llama Stack to be built for: ",
validator=Validator.from_callable(
lambda x: len(x) > 0,
error_message="Platform cannot be empty, please enter a platform",
),
default="linux/arm64",
)
cprint(
textwrap.dedent(
"""
@ -172,7 +189,10 @@ class StackBuild(Subcommand):
)
build_config = BuildConfig(
name=name, image_type=image_type, distribution_spec=distribution_spec
name=name,
image_type=image_type,
distribution_spec=distribution_spec,
platform=platform,
)
self._run_stack_build_command_from_build_config(build_config)
return