Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Added --no-cache option for building templates without cache (#735)

Mish Ushakov698959dddba7
diff --git a/.changeset/ninety-cobras-tan.md b/.changeset/ninety-cobras-tan.md
new file mode 100644
index 000000000..dce85a829
--- /dev/null
+++ b/.changeset/ninety-cobras-tan.md
@@ -0,0 +1,5 @@
+---
+'@e2b/cli': patch
+---
+
+added --no-cache option
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts
index ced78dd6d..cbdc87d7f 100644
--- a/packages/cli/src/commands/template/build.ts
+++ b/packages/cli/src/commands/template/build.ts
@@ -173,6 +173,7 @@ export const buildCommand = new commander.Command('build')
'--build-arg <args...>',
'specify additional build arguments for the build command. The format should be <varname>=<value>.'
)
+ .option('--no-cache', 'skip cache when building the template.')
.alias('bd')
.action(
async (
@@ -187,6 +188,7 @@ export const buildCommand = new commander.Command('build')
cpuCount?: number
memoryMb?: number
buildArg?: [string]
+ noCache?: boolean
}
) => {
try {
@@ -354,12 +356,15 @@ export const buildCommand = new commander.Command('build')
.map(([key, value]) => `--build-arg "${key}=${value}"`)
.join(' ')
+ const noCache = opts.noCache ? '--no-cache' : ''
+
const cmd = [
'docker build',
`-f ${dockerfileRelativePath}`,
'--pull --platform linux/amd64',
`-t docker.${connectionConfig.domain}/e2b/custom-envs/${templateID}:${template.buildID}`,
buildArgs,
+ noCache,
'.',
].join(' ')