summaryrefslogtreecommitdiff
path: root/scripts/start_sandbox.sh
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-04-28 15:44:17 -0700
committerGitHub <[email protected]>2025-04-28 15:44:17 -0700
commitcd1ddcb4f1e9bb7b27af5ae57a6d2d19693f2067 (patch)
tree5b53572d2c585111af4522f76ed2b51e2ea78298 /scripts/start_sandbox.sh
parent57ceadb7d87b77fda543ee35097e7b68c10f1e5b (diff)
SANDBOX_PORTS env var (#204)
Diffstat (limited to 'scripts/start_sandbox.sh')
-rwxr-xr-xscripts/start_sandbox.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/start_sandbox.sh b/scripts/start_sandbox.sh
index 199c1519..67c9cf27 100755
--- a/scripts/start_sandbox.sh
+++ b/scripts/start_sandbox.sh
@@ -40,7 +40,8 @@ if ! $CMD images -q "$IMAGE" | grep -q .; then
fi
# use interactive tty mode and auto-remove container on exit
-run_args=(-it --rm)
+# run init binary inside container to forward signals & reap zombies
+run_args=(-it --rm --init --workdir "$WORKDIR")
# mount current directory as $WORKDIR inside container
run_args+=(-v "$PWD:$WORKDIR")
@@ -133,10 +134,21 @@ if [ -n "${DEBUG:-}" ]; then
fi
node_args+=("$CLI_PATH" "$@")
+# open additional ports if SANDBOX_PORTS is set
+if [ -n "${SANDBOX_PORTS:-}" ]; then
+ ports=$(echo "$SANDBOX_PORTS" | tr ',' '\n')
+ for port in $ports; do
+ if [ -n "$port" ]; then
+ echo "SANDBOX_PORTS: $port"
+ run_args+=(-p "$port:$port")
+ fi
+ done
+fi
+
# run gemini-code in sandbox container
if [[ "$CMD" == "podman" ]]; then
# use empty --authfile to skip unnecessary auth refresh overhead
- $CMD run "${run_args[@]}" --init --authfile <(echo '{}') --workdir "$WORKDIR" "$IMAGE" node "${node_args[@]}"
+ $CMD run "${run_args[@]}" --authfile <(echo '{}') "$IMAGE" node "${node_args[@]}"
else
- $CMD run "${run_args[@]}" --init --workdir "$WORKDIR" "$IMAGE" node "${node_args[@]}"
+ $CMD run "${run_args[@]}" "$IMAGE" node "${node_args[@]}"
fi