Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Ship AWS CLI v2 in the E2B and Modal default images (#2168)

Regan Belle916da17c6de
diff --git a/deploy/e2b/e2b.Dockerfile b/deploy/e2b/e2b.Dockerfile
index e605b5c86..a00641b3d 100644
--- a/deploy/e2b/e2b.Dockerfile
+++ b/deploy/e2b/e2b.Dockerfile
@@ -8,5 +8,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& node --version && npm --version
+ARG AWSCLI_VERSION=2.34.54
+ARG AWSCLI_SHA256=de278754dec97e0f6e9b4e8167d4bd1a27004c3e56e9c2da10002597f76ca35a
+RUN curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWSCLI_VERSION}.zip" -o /tmp/awscliv2.zip \
+ && echo "${AWSCLI_SHA256} /tmp/awscliv2.zip" | sha256sum -c - \
+ && unzip -q /tmp/awscliv2.zip -d /tmp \
+ && /tmp/aws/install \
+ && rm -rf /tmp/aws /tmp/awscliv2.zip \
+ && aws --version
+
RUN id -u user >/dev/null 2>&1 || useradd --create-home --user-group --shell /bin/bash user
RUN mkdir -p /home/user/workspace && chown -R user:user /home/user
diff --git a/docs/modal-image.md b/docs/modal-image.md
index 87529efac..c68b9e426 100644
--- a/docs/modal-image.md
+++ b/docs/modal-image.md
@@ -22,7 +22,9 @@ With no `MODAL_IMAGE` set during the build, the image starts from QM's pinned No
base and installs its usual shell, Python, Git, curl, and archive utilities. It also
installs a pinned, checksum-verified `uv`, configures `uv pip install` to target the
system Python without a virtual environment, and preinstalls pinned requests,
-beautifulsoup4, lxml, openpyxl, pypdf and python-docx. Packages installed later with
+beautifulsoup4, lxml, openpyxl, pypdf and python-docx, plus a pinned, checksum-verified
+AWS CLI v2 so agents don't fall back to `pip install awscli` (v1, which lacks SSO
+device-code login). Packages installed later with
`uv pip install` land in `/usr/local`, outside home checkpoints, so they last until the
sandbox is replaced. To extend an existing custom image, set `MODAL_IMAGE` to its
registry reference (prefer an immutable digest) or an existing Modal image ID. Custom bases must already contain
diff --git a/src/sandbox/modal-image.ts b/src/sandbox/modal-image.ts
index 0a3c7d43b..796fc3163 100644
--- a/src/sandbox/modal-image.ts
+++ b/src/sandbox/modal-image.ts
@@ -12,13 +12,18 @@ const PYTHON_PACKAGES = [
];
const UV_VERSION = "0.12.19";
const UV_SHA256 = "23bf5552d220e0842b65c862097b2ebaeba0064b74eda5e565e77fd25969d8c8";
+const AWSCLI_VERSION = "2.34.54";
+const AWSCLI_SHA256 = "de278754dec97e0f6e9b4e8167d4bd1a27004c3e56e9c2da10002597f76ca35a";
export const MODAL_DEFAULT_IMAGE_SETUP =
"RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git jq tar xz-utils unzip python3 python3-venv openssh-client && rm -rf /var/lib/apt/lists/*" +
` && curl -fsSL -o /tmp/uv.tgz https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz` +
` && echo "${UV_SHA256} /tmp/uv.tgz" | sha256sum -c -` +
" && tar -xzf /tmp/uv.tgz -C /usr/local/bin --strip-components=1 && rm /tmp/uv.tgz" +
" && mkdir -p /etc/uv && printf '[pip]\\nsystem = true\\nbreak-system-packages = true\\n' > /etc/uv/uv.toml" +
- ` && uv pip install --no-cache --only-binary=:all: ${PYTHON_PACKAGES.join(" ")}`;
+ ` && uv pip install --no-cache --only-binary=:all: ${PYTHON_PACKAGES.join(" ")}` +
+ ` && curl -fsSL -o /tmp/awscliv2.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWSCLI_VERSION}.zip` +
+ ` && echo "${AWSCLI_SHA256} /tmp/awscliv2.zip" | sha256sum -c -` +
+ " && unzip -q /tmp/awscliv2.zip -d /tmp && /tmp/aws/install && rm -rf /tmp/aws /tmp/awscliv2.zip && aws --version";
export async function resolveModalImage(client: ModalClient, reference?: string) {
if (reference?.startsWith("im-")) return client.images.fromId(reference);