chore: migrate stack build (#3867)

# What does this PR do?
Just use editable install here. Not sure about the USE_COPY_NOT_MOUNT
that was used in original scripts and if that's needed.

## Test Plan
<img width="1008" height="587" alt="image"
src="https://github.com/user-attachments/assets/7ddf8e31-2635-45d3-b79c-1b898eefbf07"
/>

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/llamastack/llama-stack/pull/3867).
* #3869
* __->__ #3867
This commit is contained in:
ehhuang 2025-10-20 16:22:48 -07:00 committed by GitHub
parent ffeb86385c
commit 407bade359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 59 additions and 26 deletions

View file

@ -252,19 +252,24 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
export LLAMA_STACK_PORT=8321
echo "=== Building Docker Image for distribution: $DISTRO ==="
# Set LLAMA_STACK_DIR to repo root
# USE_COPY_NOT_MOUNT copies files into image (for CI), otherwise mounts for live development
BUILD_ENV="LLAMA_STACK_DIR=$ROOT_DIR"
if [[ "${CI:-false}" == "true" ]] || [[ "${GITHUB_ACTIONS:-false}" == "true" ]]; then
echo "CI detected (CI=$CI, GITHUB_ACTIONS=$GITHUB_ACTIONS): copying source into image"
BUILD_ENV="USE_COPY_NOT_MOUNT=true $BUILD_ENV"
else
echo "Local mode: will mount source for live development"
containerfile="$ROOT_DIR/containers/Containerfile"
if [[ ! -f "$containerfile" ]]; then
echo "❌ Containerfile not found at $containerfile"
exit 1
fi
eval "$BUILD_ENV llama stack build --distro '$DISTRO' --image-type container"
build_cmd=(
docker
build
"$ROOT_DIR"
-f "$containerfile"
--tag "localhost/distribution-$DISTRO:dev"
--build-arg "DISTRO_NAME=$DISTRO"
--build-arg "INSTALL_MODE=editable"
--build-arg "LLAMA_STACK_DIR=/workspace"
)
if [ $? -ne 0 ]; then
if ! "${build_cmd[@]}"; then
echo "❌ Failed to build Docker image"
exit 1
fi
@ -304,7 +309,6 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
docker run -d --network host --name "$container_name" \
-p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT \
$DOCKER_ENV_VARS \
-v $ROOT_DIR:/app/llama-stack-source \
"$IMAGE_NAME" \
--port $LLAMA_STACK_PORT