Skip to content

Commit f8d9ef3

Browse files
authored
feat: add Gemini CLI as dedicated sandbox image (#51)
Signed-off-by: minhdqdev <minhdq.dev@gmail.com>
1 parent 18cc5db commit f8d9ef3

File tree

3 files changed

+255
-0
lines changed

3 files changed

+255
-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.35.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: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
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+
- {
42+
host: api.anthropic.com,
43+
port: 443,
44+
protocol: rest,
45+
enforcement: enforce,
46+
access: full,
47+
tls: terminate,
48+
}
49+
- { host: statsig.anthropic.com, port: 443 }
50+
- { host: sentry.io, port: 443 }
51+
- { host: raw.githubusercontent.com, port: 443 }
52+
- { host: platform.claude.com, port: 443 }
53+
binaries:
54+
- { path: /usr/local/bin/claude }
55+
- { path: /usr/bin/node }
56+
57+
github_ssh_over_https:
58+
name: github-ssh-over-https
59+
endpoints:
60+
- host: github.com
61+
port: 443
62+
protocol: rest
63+
tls: terminate
64+
enforcement: enforce
65+
rules:
66+
# Git Smart HTTP read-only: allow clone, fetch, pull
67+
# Discovery (query string is included in path matching)
68+
- allow:
69+
method: GET
70+
path: "/**/info/refs*"
71+
# Data transfer for reads (all repos)
72+
- allow:
73+
method: POST
74+
path: "/**/git-upload-pack"
75+
# Data transfer for writes
76+
# - allow:
77+
# method: POST
78+
# path: "/**/git-receive-pack"
79+
binaries:
80+
- { path: /usr/bin/git }
81+
82+
nvidia_inference:
83+
name: nvidia-inference
84+
endpoints:
85+
- { host: integrate.api.nvidia.com, port: 443 }
86+
binaries:
87+
- { path: /usr/bin/curl }
88+
- { path: /bin/bash }
89+
- { path: /usr/local/bin/opencode }
90+
91+
# --- GitHub REST API (read-only) ---
92+
github_rest_api:
93+
name: github-rest-api
94+
endpoints:
95+
- host: api.github.com
96+
port: 443
97+
protocol: rest
98+
tls: terminate
99+
enforcement: enforce
100+
access: read-only
101+
binaries:
102+
- { path: /usr/local/bin/claude }
103+
- { path: /usr/bin/gh }
104+
105+
pypi:
106+
name: pypi
107+
endpoints:
108+
- { host: pypi.org, port: 443 }
109+
- { host: files.pythonhosted.org, port: 443 }
110+
# uv python install downloads from python-build-standalone on GitHub
111+
- { host: github.com, port: 443 }
112+
- { host: objects.githubusercontent.com, port: 443 }
113+
# uv resolves python-build-standalone release metadata via the GitHub API
114+
- { host: api.github.com, port: 443 }
115+
- { host: downloads.python.org, port: 443 }
116+
binaries:
117+
- { path: /sandbox/.venv/bin/python }
118+
- { path: /sandbox/.venv/bin/python3 }
119+
- { path: /sandbox/.venv/bin/pip }
120+
- { path: /app/.venv/bin/python }
121+
- { path: /app/.venv/bin/python3 }
122+
- { path: /app/.venv/bin/pip }
123+
- { path: /usr/local/bin/uv }
124+
# Managed Python installations from uv python install
125+
- { path: "/sandbox/.uv/python/**" }
126+
127+
vscode:
128+
name: vscode
129+
endpoints:
130+
- { host: update.code.visualstudio.com, port: 443 }
131+
# NOTE: OPA host matching uses exact equality, not glob — list hosts explicitly.
132+
- { host: az764295.vo.msecnd.net, port: 443 }
133+
- { host: vscode.download.prss.microsoft.com, port: 443 }
134+
- { host: marketplace.visualstudio.com, port: 443 }
135+
- { host: gallerycdn.vsassets.io, port: 443 }
136+
binaries:
137+
- { path: /usr/bin/curl }
138+
- { path: /usr/bin/wget }
139+
- { path: "/sandbox/.vscode-server/**" }
140+
- { path: "/sandbox/.vscode-remote-containers/**" }
141+
142+
cursor:
143+
name: cursor
144+
endpoints:
145+
- { host: cursor.blob.core.windows.net, port: 443 }
146+
# NOTE: OPA host matching uses exact equality, not glob — list hosts explicitly.
147+
- { host: api2.cursor.sh, port: 443 }
148+
- { host: repo.cursor.sh, port: 443 }
149+
- { host: download.cursor.sh, port: 443 }
150+
- { host: cursor.download.prss.microsoft.com, port: 443 }
151+
binaries:
152+
- { path: /usr/bin/curl }
153+
- { path: /usr/bin/wget }
154+
- { path: "/sandbox/.cursor-server/**" }
155+
156+
opencode:
157+
name: opencode
158+
endpoints:
159+
- host: registry.npmjs.org
160+
port: 443
161+
- host: opencode.ai
162+
port: 443
163+
- host: integrate.api.nvidia.com
164+
port: 443
165+
binaries:
166+
- path: /usr/lib/node_modules/opencode-ai/bin/.opencode
167+
- path: /usr/bin/node
168+
- path: /usr/local/bin/opencode
169+
170+
copilot:
171+
name: copilot
172+
endpoints:
173+
- { host: github.com, port: 443 }
174+
- { host: api.github.com, port: 443 }
175+
- { host: api.githubcopilot.com, port: 443 }
176+
- { host: api.enterprise.githubcopilot.com, port: 443 }
177+
- { host: release-assets.githubusercontent.com, port: 443 }
178+
- { host: copilot-proxy.githubusercontent.com, port: 443 }
179+
- { host: default.exp-tas.com, port: 443 }
180+
binaries:
181+
- {
182+
path: /usr/lib/node_modules/@github/copilot/node_modules/@github/**/copilot,
183+
}
184+
185+
gemini:
186+
name: gemini
187+
endpoints:
188+
- { host: generativelanguage.googleapis.com, port: 443 }
189+
- { host: "*-aiplatform.googleapis.com", port: 443 }
190+
- { host: cloudcode-pa.googleapis.com, port: 443 }
191+
- { host: accounts.google.com, port: 443 }
192+
- { host: oauth2.googleapis.com, port: 443 }
193+
- { host: www.googleapis.com, port: 443 }
194+
- { host: iamcredentials.googleapis.com, port: 443 }
195+
binaries:
196+
- { path: /usr/bin/gemini }
197+
- { path: /usr/lib/node_modules/@google/gemini-cli/dist/index.js }
198+
- { path: /usr/bin/node }

0 commit comments

Comments
 (0)