Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
2abe926d
Commit
2abe926d
authored
Mar 14, 2025
by
Ryan McCormick
Committed by
GitHub
Mar 14, 2025
Browse files
feat: Support caching nixl build stage (#147)
parent
b8120504
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
container/Dockerfile.vllm
container/Dockerfile.vllm
+13
-2
container/build.sh
container/build.sh
+21
-15
No files found.
container/Dockerfile.vllm
View file @
2abe926d
...
...
@@ -4,6 +4,16 @@
ARG BASE_IMAGE="nvcr.io/nvidia/cuda-dl-base"
ARG BASE_IMAGE_TAG="25.01-cuda12.8-devel-ubuntu24.04"
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS nixl_base
WORKDIR /opt/nixl
# Add a cache hint that only changes when the nixl commit changes
ARG NIXL_COMMIT
# This line acts as a cache key - it only changes when NIXL_COMMIT changes
RUN echo "NIXL commit: ${NIXL_COMMIT}" > /opt/nixl/commit.txt
# Copy the nixl source
COPY --from=nixl . .
# Main build stage
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS dev
USER root
...
...
@@ -117,8 +127,9 @@ ENV CPATH=/usr/local/ompi/include:$CPATH
ENV PATH=/usr/local/ompi/bin:$PATH
ENV PKG_CONFIG_PATH=/usr/local/ompi/lib/pkgconfig:$PKG_CONFIG_PATH
COPY --from=nixl . /opt/nixl
# Copy nixl source, and use commit hash as cache hint
COPY --from=nixl_base /opt/nixl /opt/nixl
COPY --from=nixl_base /opt/nixl/commit.txt /opt/nixl/commit.txt
RUN cd /opt/nixl && \
mkdir build && \
meson setup build/ --prefix=/usr/local/nixl && \
...
...
container/build.sh
View file @
2abe926d
...
...
@@ -218,7 +218,7 @@ get_options() {
if
[
-z
"
$TAG
"
]
;
then
TAG
=
"--tag dynamo:
${
VERSION
}
-
${
FRAMEWORK
,,
}
"
if
[
!
-z
${
TARGET
}
]
;
then
if
[
!
-z
"
${
TARGET
}
"
]
;
then
TAG
=
"
${
TAG
}
-
${
TARGET
}
"
fi
fi
...
...
@@ -284,28 +284,34 @@ elif [[ $FRAMEWORK == "TENSORRTLLM" ]]; then
fi
if
[[
$FRAMEWORK
==
"VLLM"
]]
;
then
TEMP_DIR
=
$(
mktemp
-d
)
# Clean up temp directory on script exit
trap
'rm -rf "$TEMP_DIR"'
EXIT
NIXL_DIR
=
"/tmp/nixl/nixl_src"
# Clone original NIXL to temp directory
if
[
!
-z
${
GITHUB_TOKEN
}
]
;
then
git clone https://oauth2:
${
GITHUB_TOKEN
}
@github.com/
${
NIXL_REPO
}
"
$TEMP_DIR
/nixl_src"
if
[
-d
"
$NIXL_DIR
"
]
;
then
echo
"Warning:
$NIXL_DIR
already exists, skipping clone"
else
# Try HTTPS first with credential prompting disabled, fall back to SSH if it fails
if
!
GIT_TERMINAL_PROMPT
=
0 git clone https://github.com/
${
NIXL_REPO
}
"
$TEMP_DIR
/nixl_src"
;
then
echo
"HTTPS clone failed, falling back to SSH..."
git clone git@github.com:
${
NIXL_REPO
}
"
$TEMP_DIR
/nixl_src"
if
[
!
-z
${
GITHUB_TOKEN
}
]
;
then
git clone https://oauth2:
${
GITHUB_TOKEN
}
@github.com/
${
NIXL_REPO
}
"
$NIXL_DIR
"
else
# Try HTTPS first with credential prompting disabled, fall back to SSH if it fails
if
!
GIT_TERMINAL_PROMPT
=
0 git clone https://github.com/
${
NIXL_REPO
}
"
$NIXL_DIR
"
;
then
echo
"HTTPS clone failed, falling back to SSH..."
git clone git@github.com:
${
NIXL_REPO
}
"
$NIXL_DIR
"
fi
fi
fi
cd
"
$TEMP_DIR
/nixl_src"
cd
"
$NIXL_DIR
"
if
!
git checkout
${
NIXL_COMMIT
}
;
then
echo
"ERROR: Failed to checkout NIXL commit
${
NIXL_COMMIT
}
. The cached directory may be out of date."
echo
"Please delete
$NIXL_DIR
and re-run the build script."
exit
1
fi
git checkout
${
NIXL_COMMIT
}
BUILD_CONTEXT_ARG+
=
" --build-context nixl=
$NIXL_DIR
"
BUILD_CONTEXT_ARG+
=
" --build-context nixl=
$TEMP_DIR
/nixl_src"
# Add NIXL_COMMIT as a build argument to enable caching
BUILD_ARGS+
=
" --build-arg NIXL_COMMIT=
${
NIXL_COMMIT
}
"
fi
# BUILD DEV IMAGE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment