Skip to content

Commit 698959d

Browse files
authored
Added --no-cache option for building templates without cache (#735)
- Adds `--no-cache` parameter to CLI `template build` command for building templates without cache.
1 parent 10db4e9 commit 698959d

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.changeset/ninety-cobras-tan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@e2b/cli': patch
3+
---
4+
5+
added --no-cache option

packages/cli/src/commands/template/build.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export const buildCommand = new commander.Command('build')
173173
'--build-arg <args...>',
174174
'specify additional build arguments for the build command. The format should be <varname>=<value>.'
175175
)
176+
.option('--no-cache', 'skip cache when building the template.')
176177
.alias('bd')
177178
.action(
178179
async (
@@ -187,6 +188,7 @@ export const buildCommand = new commander.Command('build')
187188
cpuCount?: number
188189
memoryMb?: number
189190
buildArg?: [string]
191+
noCache?: boolean
190192
}
191193
) => {
192194
try {
@@ -354,12 +356,15 @@ export const buildCommand = new commander.Command('build')
354356
.map(([key, value]) => `--build-arg "${key}=${value}"`)
355357
.join(' ')
356358

359+
const noCache = opts.noCache ? '--no-cache' : ''
360+
357361
const cmd = [
358362
'docker build',
359363
`-f ${dockerfileRelativePath}`,
360364
'--pull --platform linux/amd64',
361365
`-t docker.${connectionConfig.domain}/e2b/custom-envs/${templateID}:${template.buildID}`,
362366
buildArgs,
367+
noCache,
363368
'.',
364369
].join(' ')
365370

0 commit comments

Comments
 (0)