Boat.Snapshot reference
Snapshot
Section titled “Snapshot”Source:
packages/boat/src/Snapshot.ts
A warm base for sandboxes: a sandbox set up with your commands and its disk saved under a name. Sandboxes started from it begin exactly where the setup left off: packages installed, a repository cloned, a build cache warm.
Use a snapshot for work that is too slow to repeat per sandbox. Alchemy runs the commands in a sandbox of its own, saves it, and deletes the sandbox. A deploy re-runs the setup only when the commands or the base change, and a rebuild replaces the declared sandboxes started from it.
Snapshot: Creating a Snapshot
Section titled “Snapshot: Creating a Snapshot”A repository with its dependencies installed
export const Golden = Boat.Snapshot("Golden", { run: [ "git clone https://github.com/alchemy-run/alchemy ~/alchemy", "cd ~/alchemy && pnpm install", ],});Layer one snapshot on another
export const Tools = Boat.Snapshot("Tools", { run: ["npm i -g pnpm"] });export const Golden = Boat.Snapshot("Golden", { from: Tools, run: ["pnpm dlx playwright install"] });Snapshot: Starting sandboxes from a Snapshot
Section titled “Snapshot: Starting sandboxes from a Snapshot”A declared sandbox
export const Box = Boat.Sandbox("Box", { snapshot: Golden });Sandboxes created at run time
const sandboxes = yield* Boat.CreateSandbox(Golden);const sandbox = yield* sandboxes.create({ autoStop: "10 minutes" });Snapshot: Referencing a snapshot the stack doesn’t manage
Section titled “Snapshot: Referencing a snapshot the stack doesn’t manage”const shared = Boat.Snapshot.lookup({ name: "team-base" });const sandboxes = yield* Boat.CreateSandbox(shared);