sandbox: dynamic directory mount & snapshot#239
Conversation
d85a26d to
c3c66c1
Compare
bc627e5 to
f19da89
Compare
| @@ -0,0 +1,53 @@ | |||
| // This example shows how to use Image mounts and directory snapshots in Sandboxes. | |||
There was a problem hiding this comment.
Maybe we should add that this is an experimental feature only enabled for certain workspaces and people have to contact us if they want to use it for now
| const app = await modal.apps.fromName("libmodal-example", { | ||
| createIfMissing: true, | ||
| }); | ||
| const baseImage = modal.images.fromRegistry("debian:12-slim"); |
There was a problem hiding this comment.
Add a comment about /usr/bin/mount needing to exist in the image (for now)
|
Thanks, fixed now! |
|
Tests fail because the feature is not yet enabled in our main workspace. |
6a77328 to
ccf96a8
Compare
| * @alpha | ||
| * @param path - The path where the directory should be mounted | ||
| * @param image - Optional {@link Image} to mount. If undefined, mounts an empty directory. | ||
| */ |
There was a problem hiding this comment.
Bug: Missing /usr/bin/mount requirement in API documentation (Bugbot Rules)
Per the PR discussion, @freider requested adding a comment about /usr/bin/mount needing to exist in the image. While this requirement is documented in the example file (line 26), the JSDoc for experimentalMountImage does not mention this critical prerequisite. Users calling this API directly without seeing the example would not know their base image needs /usr/bin/mount available.
Port of modal-labs/modal-client#3791.
Note that this change is on top of #238.
Note
Introduce experimental APIs to mount Images into Sandbox directories and snapshot them into new Images, with client support, example, and tests.
Sandbox.experimentalMountImage(path, image?)to mount anImageat a Sandbox filesystem path.Sandbox.experimentalSnapshotDirectory(path)to snapshot a mounted directory into a newImage.taskMountDirectoryandtaskSnapshotDirectorycalls viaTaskCommandRouterClientImpl(mountDirectory,snapshotDirectory).TaskMountDirectoryRequestandTaskSnapshotDirectoryRequest.examples/sandbox-image-mount.tsdemonstrating mounting a repo directory and snapshotting it.test/sandbox_mount_image.test.tscovering empty mount, mount with image, snapshotting, and unbuilt image error.test/sandbox.test.ts(<4000ms).Written by Cursor Bugbot for commit a65eebd. This will update automatically on new commits. Configure here.