mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
Merge fac7e937bc
into 40fdce79b3
This commit is contained in:
commit
10ff4332da
1 changed files with 10 additions and 2 deletions
|
@ -336,6 +336,9 @@ def _generate_run_config(
|
||||||
|
|
||||||
run_config_file = build_dir / f"{image_name}-run.yaml"
|
run_config_file = build_dir / f"{image_name}-run.yaml"
|
||||||
|
|
||||||
|
# Create the directory structure for the run config file
|
||||||
|
os.makedirs(run_config_file.parent, exist_ok=True)
|
||||||
|
|
||||||
with open(run_config_file, "w") as f:
|
with open(run_config_file, "w") as f:
|
||||||
to_write = json.loads(run_config.model_dump_json())
|
to_write = json.loads(run_config.model_dump_json())
|
||||||
f.write(yaml.dump(to_write, sort_keys=False))
|
f.write(yaml.dump(to_write, sort_keys=False))
|
||||||
|
@ -371,6 +374,10 @@ def _run_stack_build_command_from_build_config(
|
||||||
if not image_name:
|
if not image_name:
|
||||||
raise ValueError("Please specify an image name when building a venv image")
|
raise ValueError("Please specify an image name when building a venv image")
|
||||||
|
|
||||||
|
# At this point, image_name should not be None due to the validation above
|
||||||
|
if not image_name:
|
||||||
|
raise ValueError("Image name is required but was not provided")
|
||||||
|
|
||||||
if template_name:
|
if template_name:
|
||||||
build_dir = DISTRIBS_BASE_DIR / template_name
|
build_dir = DISTRIBS_BASE_DIR / template_name
|
||||||
build_file_path = build_dir / f"{template_name}-build.yaml"
|
build_file_path = build_dir / f"{template_name}-build.yaml"
|
||||||
|
@ -378,7 +385,8 @@ def _run_stack_build_command_from_build_config(
|
||||||
build_dir = DISTRIBS_BASE_DIR / image_name
|
build_dir = DISTRIBS_BASE_DIR / image_name
|
||||||
build_file_path = build_dir / f"{image_name}-build.yaml"
|
build_file_path = build_dir / f"{image_name}-build.yaml"
|
||||||
|
|
||||||
os.makedirs(build_dir, exist_ok=True)
|
# Create the directory structure for the build file
|
||||||
|
os.makedirs(build_file_path.parent, exist_ok=True)
|
||||||
run_config_file = None
|
run_config_file = None
|
||||||
# Generate the run.yaml so it can be included in the container image with the proper entrypoint
|
# Generate the run.yaml so it can be included in the container image with the proper entrypoint
|
||||||
# Only do this if we're building a container image and we're not using a template
|
# Only do this if we're building a container image and we're not using a template
|
||||||
|
@ -395,7 +403,7 @@ def _run_stack_build_command_from_build_config(
|
||||||
build_file_path,
|
build_file_path,
|
||||||
image_name,
|
image_name,
|
||||||
template_or_config=template_name or config_path or str(build_file_path),
|
template_or_config=template_name or config_path or str(build_file_path),
|
||||||
run_config=run_config_file,
|
run_config=run_config_file.as_posix() if run_config_file else None,
|
||||||
)
|
)
|
||||||
if return_code != 0:
|
if return_code != 0:
|
||||||
raise RuntimeError(f"Failed to build image {image_name}")
|
raise RuntimeError(f"Failed to build image {image_name}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue