mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
feat(CI): Add a github action to build the sandbox image and push to GHCR (#8670)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
@@ -41,11 +41,13 @@ const argv = yargs(hideBin(process.argv))
|
||||
.option('f', {
|
||||
alias: 'dockerfile',
|
||||
type: 'string',
|
||||
default: 'Dockerfile',
|
||||
description: 'use <dockerfile> for custom image',
|
||||
})
|
||||
.option('i', {
|
||||
alias: 'image',
|
||||
type: 'string',
|
||||
default: cliPkgJson.config.sandboxImageUri,
|
||||
description: 'use <image> name for custom image',
|
||||
})
|
||||
.option('output-file', {
|
||||
@@ -74,12 +76,10 @@ if (sandboxCommand === 'sandbox-exec') {
|
||||
|
||||
console.log(`using ${sandboxCommand} for sandboxing`);
|
||||
|
||||
const baseImage = cliPkgJson.config.sandboxImageUri;
|
||||
const customImage = argv.i;
|
||||
const baseDockerfile = 'Dockerfile';
|
||||
const customDockerfile = argv.f;
|
||||
const image = argv.i;
|
||||
const dockerFile = argv.f;
|
||||
|
||||
if (!baseImage?.length) {
|
||||
if (!image.length) {
|
||||
console.warn(
|
||||
'No default image tag specified in gemini-cli/packages/cli/package.json',
|
||||
);
|
||||
@@ -160,7 +160,7 @@ function buildImage(imageName, dockerfile) {
|
||||
execSync(
|
||||
`${sandboxCommand} build ${buildCommandArgs} ${
|
||||
process.env.BUILD_SANDBOX_FLAGS || ''
|
||||
} --build-arg CLI_VERSION_ARG=${npmPackageVersion} -f "${dockerfile}" -t "${imageName}" .`,
|
||||
} --build-arg CLI_VERSION_ARG=${npmPackageVersion} -f "${dockerfile}" -t "${finalImageName}" .`,
|
||||
{ stdio: buildStdout, shell: shellToUse },
|
||||
);
|
||||
console.log(`built ${finalImageName}`);
|
||||
@@ -187,12 +187,6 @@ function buildImage(imageName, dockerfile) {
|
||||
}
|
||||
}
|
||||
|
||||
if (baseImage && baseDockerfile) {
|
||||
buildImage(baseImage, baseDockerfile);
|
||||
}
|
||||
|
||||
if (customDockerfile && customImage) {
|
||||
buildImage(customImage, customDockerfile);
|
||||
}
|
||||
buildImage(image, dockerFile);
|
||||
|
||||
execSync(`${sandboxCommand} image prune -f`, { stdio: 'ignore' });
|
||||
|
||||
Reference in New Issue
Block a user