From 1aeac7b9f74bac9be262726233823399ac9e14ea Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Tue, 12 Nov 2024 13:09:04 -0800 Subject: [PATCH] Change order of building the Docker --- llama_stack/distribution/build_container.sh | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/llama_stack/distribution/build_container.sh b/llama_stack/distribution/build_container.sh index a5b8c356a..0764fee62 100755 --- a/llama_stack/distribution/build_container.sh +++ b/llama_stack/distribution/build_container.sh @@ -64,6 +64,19 @@ RUN apt-get update && apt-get install -y \ EOF +# Add pip dependencies first since llama-stack is what will change most often +# so we can reuse layers. +if [ -n "$pip_dependencies" ]; then + add_to_docker "RUN pip install --no-cache $pip_dependencies" +fi + +if [ -n "$special_pip_deps" ]; then + IFS='#' read -ra parts <<<"$special_pip_deps" + for part in "${parts[@]}"; do + add_to_docker "RUN pip install --no-cache $part" + done +fi + stack_mount="/app/llama-stack-source" models_mount="/app/llama-models-source" @@ -103,16 +116,6 @@ RUN pip install --no-cache $models_mount EOF fi -if [ -n "$pip_dependencies" ]; then - add_to_docker "RUN pip install --no-cache $pip_dependencies" -fi - -if [ -n "$special_pip_deps" ]; then - IFS='#' read -ra parts <<<"$special_pip_deps" - for part in "${parts[@]}"; do - add_to_docker "RUN pip install --no-cache $part" - done -fi add_to_docker <