diff options
| author | Brandon Keiji <[email protected]> | 2025-06-18 12:43:12 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-18 19:43:12 +0000 |
| commit | cc89830b2ab74ec8d4a04e5846c7d3a08bb6d31b (patch) | |
| tree | 0d10572e97e11be46407da31cba7fbc83c3ac742 /scripts/build_sandbox.js | |
| parent | c7a422ccdd839469a6438aac00bb57c771c8489d (diff) | |
refactor: consolidate container image tag source of truth to cli package.json (#1156)
Diffstat (limited to 'scripts/build_sandbox.js')
| -rw-r--r-- | scripts/build_sandbox.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/build_sandbox.js b/scripts/build_sandbox.js index c6a16c23..941fa7f6 100644 --- a/scripts/build_sandbox.js +++ b/scripts/build_sandbox.js @@ -22,6 +22,7 @@ import { chmodSync, readFileSync, rmSync } from 'fs'; import { join } from 'path'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; +import cliPkgJson from '../packages/cli/package.json' with { type: 'json' }; const argv = yargs(hideBin(process.argv)) .option('s', { @@ -47,9 +48,7 @@ try { .toString() .trim(); } catch { - console.warn( - 'WARNING: container-based sandboxing is disabled (see README.md#sandboxing)', - ); + console.warn('ERROR: could not detect sandbox container command'); process.exit(0); } @@ -62,11 +61,17 @@ if (sandboxCommand === 'sandbox-exec') { console.log(`using ${sandboxCommand} for sandboxing`); -const baseImage = 'gemini-cli-sandbox'; +const baseImage = cliPkgJson.config.sandboxImageUri; const customImage = argv.i; const baseDockerfile = 'Dockerfile'; const customDockerfile = argv.f; +if (!baseImage?.length) { + console.warn( + 'No default image tag specified in gemini-cli/packages/cli/package.json', + ); +} + if (!argv.s) { execSync('npm install', { stdio: 'inherit' }); execSync('npm run build --workspaces', { stdio: 'inherit' }); @@ -122,7 +127,9 @@ function buildImage(imageName, dockerfile) { console.log(`built ${imageName}`); } -buildImage(baseImage, baseDockerfile); +if (baseImage && baseDockerfile) { + buildImage(baseImage, baseDockerfile); +} if (customDockerfile && customImage) { buildImage(customImage, customDockerfile); |
