The Open Framework for Building Agents
fix: avoid duplicate sandbox image layer (#2906)
Colton Padden2b527147ab52
diff --git a/.changeset/slim-sandbox-image-layer.md b/.changeset/slim-sandbox-image-layer.mdnew file mode 100644index 000000000..106e639b2--- /dev/null+++ b/.changeset/slim-sandbox-image-layer.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Reduce the published sandbox image by avoiding a duplicate ownership-only layer while preserving global npm and pnpm installs for sandbox users.diff --git a/.github/workflows/docker-image-size-analysis.yml b/.github/workflows/docker-image-size-analysis.ymlindex 6992ca181..e6d28b9b2 100644--- a/.github/workflows/docker-image-size-analysis.yml+++ b/.github/workflows/docker-image-size-analysis.yml@@ -99,6 +99,8 @@ jobs:set -euo pipefailtest "$(id -un)" = vercel-sandboxtest "$(stat -c %U /workspace)" = vercel-sandbox+ test "$(npm prefix -g)" = "$HOME/.local"+ test "$(pnpm bin -g)" = "$PNPM_HOME/bin"git init --quiet /workspacegit -C /workspace remote add origin https://github.com/vercel/eve.gitsudo -n truediff --git a/packages/eve/Dockerfile b/packages/eve/Dockerfileindex dcaf4c78b..5f9d20834 100644--- a/packages/eve/Dockerfile+++ b/packages/eve/Dockerfile@@ -73,16 +73,19 @@ RUN set -eux; \if ! id -u vercel-sandbox >/dev/null 2>&1; then \useradd --create-home --shell /bin/bash vercel-sandbox; \fi; \- npm_prefix="$(npm prefix -g)"; \- mkdir -p "${npm_prefix}/bin" "${npm_prefix}/lib/node_modules" "${npm_prefix}/share"; \- chown -R vercel-sandbox:vercel-sandbox \- "${npm_prefix}/bin" \- "${npm_prefix}/lib/node_modules" \- "${npm_prefix}/share"; \+ # Keep Node and pnpm root-owned: recursively changing their ownership copies+ # them into another image layer. A small user-owned prefix retains global installs.+ install -d --owner=vercel-sandbox --group=vercel-sandbox \+ /home/vercel-sandbox/.local \+ /home/vercel-sandbox/.local/share/pnpm; \mkdir -p /workspace; \chown vercel-sandbox:vercel-sandbox /workspace; \printf 'vercel-sandbox ALL=(ALL) NOPASSWD:ALL\n' >/etc/sudoers.d/vercel-sandbox; \chmod 0440 /etc/sudoers.d/vercel-sandbox+ENV NPM_CONFIG_PREFIX=/home/vercel-sandbox/.local+ENV PNPM_HOME=/home/vercel-sandbox/.local/share/pnpm+ENV PATH=/home/vercel-sandbox/.local/share/pnpm/bin:/home/vercel-sandbox/.local/bin:${PATH}+USER vercel-sandboxWORKDIR /workspace