Skip to content

Commit 0a5ee5f

Browse files
cld2labs/sglang-gpt-oss: pull buildkit from upstream GitHub release
Ubuntu 22.04 doesn't ship a `buildkit` apt package — `apt install buildkit` errors with "Unable to locate package". Fetch buildkit (~30 MB) from moby/buildkit GitHub releases and install /usr/local/bin/buildctl + /usr/local/bin/buildkitd directly. Default pinned version v0.18.1; override with BUILDKIT_VERSION env var. Also tighten the buildkitd-startup poll: wait up to 10 s for the unix socket, hard-fail with a pointer to the log file if it never appears (better than the previous silent continue).
1 parent 6e7c564 commit 0a5ee5f

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

core/helm-charts/sglang/image-build/build-and-import.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,31 @@ echo "==> Detected container runtime: $RUNTIME"
3232

3333
case "$RUNTIME" in
3434
nerdctl)
35-
# nerdctl needs buildkitd to run `nerdctl build`. On OPEA-deployed
36-
# clusters buildkit isn't installed by default; install + start it
37-
# if missing.
35+
# nerdctl needs buildkitd to run `nerdctl build`. buildkit isn't in
36+
# Ubuntu apt — install from upstream GitHub releases (~30 MB).
3837
if ! command -v buildctl >/dev/null 2>&1; then
39-
echo "==> Installing buildkit (required by nerdctl build)"
40-
apt-get update
41-
DEBIAN_FRONTEND=noninteractive apt-get install -y buildkit
38+
BUILDKIT_VERSION="${BUILDKIT_VERSION:-v0.18.1}"
39+
echo "==> Installing buildkit ${BUILDKIT_VERSION} from GitHub releases"
40+
tmpdir=$(mktemp -d)
41+
curl -fsSL \
42+
"https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-amd64.tar.gz" \
43+
| tar -xz -C "$tmpdir"
44+
install -m 0755 "$tmpdir/bin/buildctl" /usr/local/bin/buildctl
45+
install -m 0755 "$tmpdir/bin/buildkitd" /usr/local/bin/buildkitd
46+
rm -rf "$tmpdir"
4247
fi
4348
if ! pgrep -x buildkitd >/dev/null 2>&1; then
4449
echo "==> Starting buildkitd in the background"
45-
systemctl enable --now buildkit 2>/dev/null \
46-
|| nohup buildkitd >/var/log/buildkitd.log 2>&1 &
47-
# give it a couple seconds to come up
48-
for i in 1 2 3 4 5; do
50+
mkdir -p /run/buildkit
51+
nohup /usr/local/bin/buildkitd >/var/log/buildkitd.log 2>&1 &
52+
for i in 1 2 3 4 5 6 7 8 9 10; do
4953
[ -S /run/buildkit/buildkitd.sock ] && break
5054
sleep 1
5155
done
56+
[ -S /run/buildkit/buildkitd.sock ] || {
57+
echo "buildkitd did not come up; see /var/log/buildkitd.log" >&2
58+
exit 1
59+
}
5260
fi
5361

5462
# nerdctl builds directly into containerd's image store. Pin namespace

0 commit comments

Comments
 (0)