summaryrefslogtreecommitdiff
path: root/scripts/start_sandbox.sh
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-04-21 07:50:18 -0700
committerGitHub <[email protected]>2025-04-21 07:50:18 -0700
commit39bdedab9c218ca1e4eb7204e7c1dd085be98635 (patch)
tree83806d21e6bbf036b92d9b792999d9474d4a9389 /scripts/start_sandbox.sh
parentbfb064024e3e88c0f707595b50e48a1e7c65063b (diff)
seamless sandboxing (just set GEMINI_CODE_SANDBOX=true in .env) (#76)
Diffstat (limited to 'scripts/start_sandbox.sh')
-rwxr-xr-xscripts/start_sandbox.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/start_sandbox.sh b/scripts/start_sandbox.sh
new file mode 100755
index 00000000..64964600
--- /dev/null
+++ b/scripts/start_sandbox.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+set -euo pipefail
+
+IMAGE=gemini-code-sandbox
+CLI_DIST=/usr/local/share/npm-global/lib/node_modules/\@gemini-code/cli
+WORKDIR=/sandbox/$(basename "$PWD")
+
+# use docker if installed, otherwise try to use podman instead
+if command -v docker &> /dev/null; then
+ CMD=docker
+elif command -v podman &> /dev/null; then
+ CMD=podman
+else
+ echo "ERROR: missing docker or podman for sandboxing"
+ exit 1
+fi
+
+# run gemini-code in sandbox container
+# use empty --authfile to skip unnecessary auth refresh overhead
+$CMD run -it --rm --authfile <(echo '{}') -v"$PWD:$WORKDIR" --workdir "$WORKDIR" "$IMAGE" node "$CLI_DIST" \ No newline at end of file