add cache images logic
This commit is contained in:
parent
16aeb5099d
commit
3676944088
3 changed files with 11 additions and 0 deletions
|
|
@ -207,6 +207,12 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||
Usage: "cache destination for the build cache",
|
||||
Destination: &settings.Build.CacheTo,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "cache-images",
|
||||
EnvVars: []string{"PLUGIN_CACHE_IMAGES"},
|
||||
Usage: "list of images to use for build cache. applies both to and from flags for each image",
|
||||
Destination: &settings.Build.CacheImages,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "pull-image",
|
||||
EnvVars: []string{"PLUGIN_PULL_IMAGE"},
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
|||
if build.CacheTo != "" {
|
||||
args = append(args, "--cache-to", build.CacheTo)
|
||||
}
|
||||
for _, arg := range build.CacheImages.Value() {
|
||||
args = append(args, "--cache-from", arg)
|
||||
args = append(args, string("--cache-to=type=registry,ref="+arg+",mode=max,image-manifest=true,oci-mediatypes=true"))
|
||||
}
|
||||
for _, arg := range build.ArgsEnv.Value() {
|
||||
addProxyValue(&build, arg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ type Build struct {
|
|||
Pull bool // Docker build pull
|
||||
CacheFrom string // Docker build cache-from
|
||||
CacheTo string // Docker build cache-to
|
||||
CacheImages cli.StringSlice // Docker build cache images
|
||||
Compress bool // Docker build compress
|
||||
Repo cli.StringSlice // Docker build repository
|
||||
NoCache bool // Docker build no-cache
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue