Part 4: Update the Image
Add a command
Section titled “Add a command”Install pnpm into the warm image:
export const Warm = Modal.Image("Warm", { app: Coder, from: Node, run: ["git clone --depth 1 https://github.com/sindresorhus/is /work"], run: ["git clone --depth 1 https://github.com/sindresorhus/is /work", "npm install -g pnpm"],});Deploy the new base
Section titled “Deploy the new base”pnpm alchemy deploybun alchemy deploynpx alchemy deployyarn alchemy deployrun changed, so Modal builds a new image: it runs the commands again in a fresh sandbox and saves the result. The Worker is unchanged and isn’t redeployed.
curl -X POST "$URL/users/ada/run" -d 'pnpm --version'curl -X POST "$URL/users/ada/run" -d 'pnpm --version'curl -X POST "$URL/users/ada/run" -d 'pnpm --version'curl -X POST "$URL/users/ada/run" -d 'pnpm --version'Users keep their files
Section titled “Users keep their files”A sandbox that’s already running keeps the image it booted from, until its command exits. Every sandbox started after the deploy boots from the new Warm, and mounts the same user volume, so Ada’s notes are still there, now next to pnpm.
Part 5 tests it.