mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-30 23:51:00 +00:00
clean up build
This commit is contained in:
parent
5161a8ef8c
commit
676b07e91e
3 changed files with 10 additions and 20 deletions
|
@ -234,7 +234,7 @@ class StackBuild(Subcommand):
|
||||||
run_config_file = build_dir / f"{build_config.name}-run.yaml"
|
run_config_file = build_dir / f"{build_config.name}-run.yaml"
|
||||||
|
|
||||||
with open(run_config_file, "w") as f:
|
with open(run_config_file, "w") as f:
|
||||||
to_write = json.loads(json.dumps(run_config.model_dump(), cls=EnumEncoder))
|
to_write = json.loads(build_config.model_dump_json())
|
||||||
f.write(yaml.dump(to_write, sort_keys=False))
|
f.write(yaml.dump(to_write, sort_keys=False))
|
||||||
|
|
||||||
cprint(
|
cprint(
|
||||||
|
@ -252,25 +252,14 @@ class StackBuild(Subcommand):
|
||||||
|
|
||||||
from llama_stack.distribution.build import build_image, ImageType
|
from llama_stack.distribution.build import build_image, ImageType
|
||||||
from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
|
from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
|
||||||
from llama_stack.distribution.utils.serialize import EnumEncoder
|
|
||||||
|
|
||||||
# save build.yaml spec for building same distribution again
|
# save build.yaml spec for building same distribution again
|
||||||
if build_config.image_type == ImageType.docker.value:
|
build_dir = DISTRIBS_BASE_DIR / f"llamastack-{build_config.name}"
|
||||||
# docker needs build file to be in the llama-stack repo dir to be able to copy over to the image
|
|
||||||
llama_stack_path = Path(
|
|
||||||
os.path.abspath(__file__)
|
|
||||||
).parent.parent.parent.parent
|
|
||||||
build_dir = llama_stack_path / "tmp/configs/"
|
|
||||||
else:
|
|
||||||
build_dir = DISTRIBS_BASE_DIR / f"llamastack-{build_config.name}"
|
|
||||||
|
|
||||||
os.makedirs(build_dir, exist_ok=True)
|
os.makedirs(build_dir, exist_ok=True)
|
||||||
build_file_path = build_dir / f"{build_config.name}-build.yaml"
|
build_file_path = build_dir / f"{build_config.name}-build.yaml"
|
||||||
|
|
||||||
with open(build_file_path, "w") as f:
|
with open(build_file_path, "w") as f:
|
||||||
to_write = json.loads(
|
to_write = json.loads(build_config.model_dump_json())
|
||||||
json.dumps(build_config.model_dump(), cls=EnumEncoder)
|
|
||||||
)
|
|
||||||
f.write(yaml.dump(to_write, sort_keys=False))
|
f.write(yaml.dump(to_write, sort_keys=False))
|
||||||
|
|
||||||
return_code = build_image(build_config, build_file_path)
|
return_code = build_image(build_config, build_file_path)
|
||||||
|
|
|
@ -36,7 +36,6 @@ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
REPO_DIR=$(dirname $(dirname "$SCRIPT_DIR"))
|
REPO_DIR=$(dirname $(dirname "$SCRIPT_DIR"))
|
||||||
DOCKER_BINARY=${DOCKER_BINARY:-docker}
|
DOCKER_BINARY=${DOCKER_BINARY:-docker}
|
||||||
DOCKER_OPTS=${DOCKER_OPTS:-}
|
DOCKER_OPTS=${DOCKER_OPTS:-}
|
||||||
REPO_CONFIGS_DIR="$REPO_DIR/tmp/configs"
|
|
||||||
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
|
||||||
|
@ -138,7 +137,6 @@ set -x
|
||||||
$DOCKER_BINARY build $DOCKER_OPTS -t $image_name -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
$DOCKER_BINARY build $DOCKER_OPTS -t $image_name -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
||||||
|
|
||||||
# clean up tmp/configs
|
# clean up tmp/configs
|
||||||
rm -rf $REPO_CONFIGS_DIR
|
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
echo "Success!"
|
echo "Success!"
|
||||||
|
|
|
@ -12,10 +12,13 @@ from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class TGIImplConfig(BaseModel):
|
class TGIImplConfig(BaseModel):
|
||||||
url: str = Field(
|
host: str = "localhost"
|
||||||
description="The URL for the TGI endpoint (e.g. 'http://localhost:8080')",
|
port: int = 8080
|
||||||
default="http://localhost:8080",
|
|
||||||
)
|
@property
|
||||||
|
def url(self) -> str:
|
||||||
|
return f"http://{self.host}:{self.port}"
|
||||||
|
|
||||||
api_token: Optional[str] = Field(
|
api_token: Optional[str] = Field(
|
||||||
default=None,
|
default=None,
|
||||||
description="A bearer token if your TGI endpoint is protected.",
|
description="A bearer token if your TGI endpoint is protected.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue