Skip to content

Commit 20b19c7

Browse files
authored
refactor: update byo sample base images to work with substrate (kagent-dev#2121)
The existing `trixie-slim` image which uses glibc `2.41` runs into a segfault when running on substrate. This is due to gvisor unable to restore a process linked to glibc `2.41` but works against bookworm's glibc `2.36`. This PR updates the sample crew-ai, and langgraph BYO sample dockerfiles to use a base image confirmed to work with substrate as well as enables the `uv-managed` preference which statically linked libpython which is not corrupted on substrate restore. **Testing** - Deployed and tested all variations of the sample BYO agents as `Agent` and `SandboxAgent`. --------- Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
1 parent 13fb436 commit 20b19c7

5 files changed

Lines changed: 55 additions & 5 deletions

File tree

python/samples/crewai/poem_flow/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### STAGE 1: base image
22
ARG DOCKER_REGISTRY=ghcr.io
33
ARG VERSION=latest
4-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
4+
# substrate's gVisor (ateom) checkpoint/restore segfaults processes linked against trixie's newer glibc
5+
# use bookworm to align with the kagent-adk runtime image
6+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
57

68
WORKDIR /app
79

@@ -11,6 +13,14 @@ RUN apt-get update && apt-get install -y \
1113
&& rm -rf /var/lib/apt/lists/* \
1214
&& apt-get clean
1315

16+
# this mirrors the kagent-adk's uv configuration and is needed to work on substrate
17+
# as gVisor checkpoint/restore segfaults the base image's system
18+
# CPython on restore and the standalone build survives. Both this and the bookworm base
19+
# are needed for BYO to work on substrate as this pins the base image to use a base image with glibc 2.36
20+
# where as the prvious base image python3.13-trixie-slim used glibc 2.41
21+
ENV UV_PYTHON_PREFERENCE=only-managed
22+
ENV UV_PYTHON_INSTALL_DIR=/python
23+
1424
# Copy project files
1525
COPY samples samples
1626
COPY packages packages

python/samples/crewai/research-crew/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### STAGE 1: base image
22
ARG DOCKER_REGISTRY=ghcr.io
33
ARG VERSION=latest
4-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
4+
# substrate's gVisor (ateom) checkpoint/restore segfaults processes linked against trixie's newer glibc
5+
# use bookworm to align with the kagent-adk runtime image
6+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
57

68
WORKDIR /app
79

@@ -11,6 +13,14 @@ RUN apt-get update && apt-get install -y \
1113
&& rm -rf /var/lib/apt/lists/* \
1214
&& apt-get clean
1315

16+
# this mirrors the kagent-adk's uv configuration and is needed to work on substrate
17+
# as gVisor checkpoint/restore segfaults the base image's system
18+
# CPython on restore and the standalone build survives. Both this and the bookworm base
19+
# are needed for BYO to work on substrate as this pins the base image to use a base image with glibc 2.36
20+
# where as the prvious base image python3.13-trixie-slim used glibc 2.41
21+
ENV UV_PYTHON_PREFERENCE=only-managed
22+
ENV UV_PYTHON_INSTALL_DIR=/python
23+
1424
# Copy project files
1525
COPY samples samples
1626
COPY packages packages

python/samples/langgraph/currency/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### STAGE 1: base image
22
ARG DOCKER_REGISTRY=ghcr.io
33
ARG VERSION=latest
4-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
4+
# substrate's gVisor (ateom) checkpoint/restore segfaults processes linked against trixie's newer glibc
5+
# use bookworm to align with the kagent-adk runtime image
6+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
57

68
WORKDIR /app
79

@@ -11,6 +13,14 @@ RUN apt-get update && apt-get install -y \
1113
&& rm -rf /var/lib/apt/lists/* \
1214
&& apt-get clean
1315

16+
# this mirrors the kagent-adk's uv configuration and is needed to work on substrate
17+
# as gVisor checkpoint/restore segfaults the base image's system
18+
# CPython on restore and the standalone build survives. Both this and the bookworm base
19+
# are needed for BYO to work on substrate as this pins the base image to use a base image with glibc 2.36
20+
# where as the prvious base image python3.13-trixie-slim used glibc 2.41
21+
ENV UV_PYTHON_PREFERENCE=only-managed
22+
ENV UV_PYTHON_INSTALL_DIR=/python
23+
1424
# Copy project files
1525
COPY samples samples
1626
COPY packages packages

python/samples/langgraph/hitl-tools/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### STAGE 1: base image
22
ARG DOCKER_REGISTRY=ghcr.io
33
ARG VERSION=latest
4-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
4+
# substrate's gVisor (ateom) checkpoint/restore segfaults processes linked against trixie's newer glibc
5+
# use bookworm to align with the kagent-adk runtime image
6+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
57

68
WORKDIR /app
79

@@ -11,6 +13,14 @@ RUN apt-get update && apt-get install -y \
1113
&& rm -rf /var/lib/apt/lists/* \
1214
&& apt-get clean
1315

16+
# this mirrors the kagent-adk's uv configuration and is needed to work on substrate
17+
# as gVisor checkpoint/restore segfaults the base image's system
18+
# CPython on restore and the standalone build survives. Both this and the bookworm base
19+
# are needed for BYO to work on substrate as this pins the base image to use a base image with glibc 2.36
20+
# where as the prvious base image python3.13-trixie-slim used glibc 2.41
21+
ENV UV_PYTHON_PREFERENCE=only-managed
22+
ENV UV_PYTHON_INSTALL_DIR=/python
23+
1424
# Copy project files
1525
COPY samples samples
1626
COPY packages packages

python/samples/langgraph/kebab/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### STAGE 1: base image
22
ARG DOCKER_REGISTRY=ghcr.io
33
ARG VERSION=latest
4-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
4+
# substrate's gVisor (ateom) checkpoint/restore segfaults processes linked against trixie's newer glibc
5+
# use bookworm to align with the kagent-adk runtime image
6+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
57

68
WORKDIR /app
79

@@ -12,6 +14,14 @@ RUN apt-get update && apt-get install -y \
1214
&& rm -rf /var/lib/apt/lists/* \
1315
&& apt-get clean
1416

17+
# this mirrors the kagent-adk's uv configuration and is needed to work on substrate
18+
# as gVisor checkpoint/restore segfaults the base image's system
19+
# CPython on restore and the standalone build survives. Both this and the bookworm base
20+
# are needed for BYO to work on substrate as this pins the base image to use a base image with glibc 2.36
21+
# where as the prvious base image python3.13-trixie-slim used glibc 2.41
22+
ENV UV_PYTHON_PREFERENCE=only-managed
23+
ENV UV_PYTHON_INSTALL_DIR=/python
24+
1525
# Same layout as currency: context must be ./python (full uv workspace).
1626
COPY samples samples
1727
COPY packages packages

0 commit comments

Comments
 (0)