Skip to content

Commit ea8489c

Browse files
committed
feat: add Gemini CLI as dedicated sandbox image
Signed-off-by: minhdqdev <minhdq.dev@gmail.com>
1 parent 18cc5db commit ea8489c

File tree

3 files changed

+217
-0
lines changed

3 files changed

+217
-0
lines changed

sandboxes/gemini/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Gemini CLI sandbox image for OpenShell
7+
#
8+
# Builds on the community base sandbox and adds Google Gemini CLI.
9+
# Build: docker build -t openshell-gemini --build-arg BASE_IMAGE=openshell-base .
10+
# Run: openshell sandbox create --from gemini
11+
12+
ARG BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest
13+
FROM ${BASE_IMAGE}
14+
15+
USER root
16+
17+
# Install Gemini CLI (pinned for reproducibility)
18+
RUN npm install -g @google/gemini-cli@0.35.0
19+
20+
# Copy sandbox policy
21+
COPY policy.yaml /etc/openshell/policy.yaml
22+
23+
# Create Gemini config directory
24+
RUN mkdir -p /sandbox/.gemini && \
25+
chown sandbox:sandbox /sandbox/.gemini
26+
27+
USER sandbox
28+
29+
ENTRYPOINT ["/bin/bash"]

sandboxes/gemini/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Gemini CLI Sandbox
2+
3+
OpenShell sandbox image pre-configured with [Gemini CLI](https://github.com/google-gemini/gemini-cli) for Google AI-powered coding assistance.
4+
5+
## What's Included
6+
7+
- **Gemini CLI** (`@google/gemini-cli@0.34.0`) — Google Gemini AI coding agent
8+
- Everything from the [base sandbox](../base/README.md)
9+
10+
## Build
11+
12+
```bash
13+
docker build -t openshell-gemini .
14+
```
15+
16+
To build against a specific base image:
17+
18+
```bash
19+
docker build -t openshell-gemini --build-arg BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest .
20+
```
21+
22+
## Usage
23+
24+
### Create a sandbox
25+
26+
```bash
27+
openshell sandbox create --from gemini
28+
```

sandboxes/gemini/policy.yaml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
version: 1
5+
6+
# --- Sandbox setup configuration (queried once at startup) ---
7+
8+
filesystem_policy:
9+
include_workdir: true
10+
read_only:
11+
- /usr
12+
- /lib
13+
- /proc
14+
- /dev/urandom
15+
- /app
16+
- /etc
17+
- /var/log
18+
read_write:
19+
- /sandbox
20+
- /tmp
21+
- /dev/null
22+
23+
landlock:
24+
compatibility: best_effort
25+
26+
process:
27+
run_as_user: sandbox
28+
run_as_group: sandbox
29+
30+
# --- Network policies (queried per-CONNECT request) ---
31+
#
32+
# Each named policy maps a set of allowed (binary, endpoint) pairs.
33+
# Binary identity is resolved via /proc/net/tcp inode lookup + /proc/{pid}/exe.
34+
# Ancestors (/proc/{pid}/status PPid walk) and cmdline paths are also matched.
35+
# SHA256 integrity is enforced in Rust via trust-on-first-use, not here.
36+
37+
network_policies:
38+
claude_code:
39+
name: claude-code
40+
endpoints:
41+
- { host: api.anthropic.com, port: 443, protocol: rest, enforcement: enforce, access: full, tls: terminate }
42+
- { host: statsig.anthropic.com, port: 443 }
43+
- { host: sentry.io, port: 443 }
44+
- { host: raw.githubusercontent.com, port: 443 }
45+
- { host: platform.claude.com, port: 443 }
46+
binaries:
47+
- { path: /usr/local/bin/claude }
48+
- { path: /usr/bin/node }
49+
50+
github_ssh_over_https:
51+
name: github-ssh-over-https
52+
endpoints:
53+
- host: github.com
54+
port: 443
55+
protocol: rest
56+
tls: terminate
57+
enforcement: enforce
58+
rules:
59+
# Git Smart HTTP read-only: allow clone, fetch, pull
60+
# Discovery (query string is included in path matching)
61+
- allow:
62+
method: GET
63+
path: "/**/info/refs*"
64+
# Data transfer for reads (all repos)
65+
- allow:
66+
method: POST
67+
path: "/**/git-upload-pack"
68+
# Data transfer for writes
69+
# - allow:
70+
# method: POST
71+
# path: "/**/git-receive-pack"
72+
binaries:
73+
- { path: /usr/bin/git }
74+
75+
nvidia_inference:
76+
name: nvidia-inference
77+
endpoints:
78+
- { host: integrate.api.nvidia.com, port: 443 }
79+
binaries:
80+
- { path: /usr/bin/curl }
81+
- { path: /bin/bash }
82+
- { path: /usr/local/bin/opencode }
83+
84+
# --- GitHub REST API (read-only) ---
85+
github_rest_api:
86+
name: github-rest-api
87+
endpoints:
88+
- host: api.github.com
89+
port: 443
90+
protocol: rest
91+
tls: terminate
92+
enforcement: enforce
93+
access: read-only
94+
binaries:
95+
- { path: /usr/local/bin/claude }
96+
- { path: /usr/bin/gh }
97+
98+
pypi:
99+
name: pypi
100+
endpoints:
101+
- { host: pypi.org, port: 443 }
102+
- { host: files.pythonhosted.org, port: 443 }
103+
# uv python install downloads from python-build-standalone on GitHub
104+
- { host: github.com, port: 443 }
105+
- { host: objects.githubusercontent.com, port: 443 }
106+
# uv resolves python-build-standalone release metadata via the GitHub API
107+
- { host: api.github.com, port: 443 }
108+
- { host: downloads.python.org, port: 443 }
109+
binaries:
110+
- { path: /sandbox/.venv/bin/python }
111+
- { path: /sandbox/.venv/bin/python3 }
112+
- { path: /sandbox/.venv/bin/pip }
113+
- { path: /app/.venv/bin/python }
114+
- { path: /app/.venv/bin/python3 }
115+
- { path: /app/.venv/bin/pip }
116+
- { path: /usr/local/bin/uv }
117+
# Managed Python installations from uv python install
118+
- { path: "/sandbox/.uv/python/**" }
119+
120+
opencode:
121+
name: opencode
122+
endpoints:
123+
- host: registry.npmjs.org
124+
port: 443
125+
- host: opencode.ai
126+
port: 443
127+
- host: integrate.api.nvidia.com
128+
port: 443
129+
binaries:
130+
- path: /usr/lib/node_modules/opencode-ai/bin/.opencode
131+
- path: /usr/bin/node
132+
- path: /usr/local/bin/opencode
133+
134+
copilot:
135+
name: copilot
136+
endpoints:
137+
- { host: github.com, port: 443 }
138+
- { host: api.github.com, port: 443 }
139+
- { host: api.githubcopilot.com, port: 443 }
140+
- { host: api.enterprise.githubcopilot.com, port: 443 }
141+
- { host: release-assets.githubusercontent.com, port: 443 }
142+
- { host: copilot-proxy.githubusercontent.com, port: 443 }
143+
- { host: default.exp-tas.com, port: 443 }
144+
binaries:
145+
- { path: /usr/lib/node_modules/@github/copilot/node_modules/@github/**/copilot }
146+
147+
gemini:
148+
name: gemini
149+
endpoints:
150+
- { host: generativelanguage.googleapis.com, port: 443 }
151+
- { host: "*-aiplatform.googleapis.com", port: 443 }
152+
- { host: cloudcode-pa.googleapis.com, port: 443 }
153+
- { host: accounts.google.com, port: 443 }
154+
- { host: oauth2.googleapis.com, port: 443 }
155+
- { host: www.googleapis.com, port: 443 }
156+
- { host: iamcredentials.googleapis.com, port: 443 }
157+
binaries:
158+
- { path: /usr/bin/gemini }
159+
- { path: /usr/lib/node_modules/@google/gemini-cli/dist/index.js }
160+
- { path: /usr/bin/node }

0 commit comments

Comments
 (0)