-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathbuild.sh
More file actions
29 lines (24 loc) · 896 Bytes
/
Copy pathbuild.sh
File metadata and controls
29 lines (24 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
# Build a forkd parent rootfs from E2B's code-interpreter template.
#
# The image is published by e2bdev on Docker Hub; pulling it requires
# network access. ~600 MB on disk after extraction.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
IMAGE="${IMAGE:-e2bdev/code-interpreter:latest}"
SIZE_MIB="${SIZE_MIB:-1024}"
OUT="$SCRIPT_DIR/parent.ext4"
[ "$(id -u)" -eq 0 ] || { echo "run as root" >&2; exit 1; }
bash "$REPO_ROOT/scripts/build-rootfs.sh" \
"$IMAGE" \
"$OUT" \
"$SIZE_MIB"
echo
echo "parent rootfs ready: $OUT ($(du -h "$OUT" | cut -f1))"
echo
echo "next:"
echo " sudo forkd snapshot --tag ci --kernel <vmlinux> --rootfs $OUT --tap forkd-tap0"
echo
echo "tip: use the E2B-compatible Python SDK"
echo " from forkd import Sandbox # drop-in for: from e2b import Sandbox"