Add '--cache-from' option to balena build and deploy commands

It implements the same feature as the "docker build --cache-from" option.

Resolves: #1616
Change-type: minor
This commit is contained in:
Paulo Castro 2020-02-12 11:35:03 +00:00
parent 5e196b8f63
commit a1c406a479
2 changed files with 17 additions and 0 deletions

View File

@ -1968,6 +1968,10 @@ The alias to the generated image
Set a build-time variable (eg. "-B 'ARG=value'"). Can be specified multiple times.
#### --cache-from <image-list>
Comma-separated list (no spaces) of image names for build cache resolution. Implements the same feature as the "docker build --cache-from" option.
#### --nocache
Don't use docker layer caching when building
@ -2097,6 +2101,10 @@ The alias to the generated image
Set a build-time variable (eg. "-B 'ARG=value'"). Can be specified multiple times.
#### --cache-from <image-list>
Comma-separated list (no spaces) of image names for build cache resolution. Implements the same feature as the "docker build --cache-from" option.
#### --nocache
Don't use docker layer caching when building

View File

@ -83,6 +83,13 @@ exports.appendOptions = (opts) ->
description: 'Set a build-time variable (eg. "-B \'ARG=value\'"). Can be specified multiple times.'
alias: 'B'
},
{
signature: 'cache-from'
parameter: 'image-list'
description: '
Comma-separated list (no spaces) of image names for build cache resolution.
Implements the same feature as the "docker build --cache-from" option.'
},
{
signature: 'nocache'
description: "Don't use docker layer caching when building"
@ -160,6 +167,8 @@ exports.generateBuildOpts = (options) ->
opts.t = options.tag
if options.nocache?
opts.nocache = true
if options['cache-from']?.trim()
opts.cachefrom = options['cache-from'].split(',').filter((i) -> !!i.trim())
if options.squash?
opts.squash = true
if options.buildArg?