Skip to content

Commit

Permalink
fix: update build_container.sh to ensure llama-models is installed first
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinb committed Feb 24, 2025
1 parent 17162b9 commit 0973d38
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions llama_stack/distribution/build_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ fi
stack_mount="/app/llama-stack-source"
models_mount="/app/llama-models-source"

if [ -n "$LLAMA_MODELS_DIR" ]; then
if [ ! -d "$LLAMA_MODELS_DIR" ]; then
echo "${RED}Warning: LLAMA_MODELS_DIR is set but directory does not exist: $LLAMA_MODELS_DIR${NC}" >&2
exit 1
fi

if [ "$USE_COPY_NOT_MOUNT" = "true" ]; then
add_to_container << EOF
COPY $LLAMA_MODELS_DIR $models_mount
EOF
fi
add_to_container << EOF
RUN uv pip install --no-cache -e $models_mount
EOF
fi

if [ -n "$LLAMA_STACK_DIR" ]; then
if [ ! -d "$LLAMA_STACK_DIR" ]; then
echo "${RED}Warning: LLAMA_STACK_DIR is set but directory does not exist: $LLAMA_STACK_DIR${NC}" >&2
Expand Down Expand Up @@ -134,6 +150,7 @@ RUN uv pip install fastapi libcst
EOF
add_to_container << EOF
RUN uv pip install --no-cache --extra-index-url https://test.pypi.org/simple/ \
--index-strategy unsafe-best-match \
llama-models==$TEST_PYPI_VERSION llama-stack-client==$TEST_PYPI_VERSION llama-stack==$TEST_PYPI_VERSION
EOF
Expand All @@ -149,23 +166,6 @@ EOF
fi
fi

if [ -n "$LLAMA_MODELS_DIR" ]; then
if [ ! -d "$LLAMA_MODELS_DIR" ]; then
echo "${RED}Warning: LLAMA_MODELS_DIR is set but directory does not exist: $LLAMA_MODELS_DIR${NC}" >&2
exit 1
fi

if [ "$USE_COPY_NOT_MOUNT" = "true" ]; then
add_to_container << EOF
COPY $LLAMA_MODELS_DIR $models_mount
EOF
fi
add_to_container << EOF
RUN uv pip uninstall llama-models
RUN uv pip install --no-cache $models_mount
EOF
fi

# if template_or_config ends with .yaml, it is not a template and we should not use the --template flag
if [[ "$template_or_config" != *.yaml ]]; then
add_to_container << EOF
Expand Down

0 comments on commit 0973d38

Please sign in to comment.