mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-22 20:20:39 +00:00
Add docker pull images to main command batch array. Among other cleanup
This commit is contained in:
parent
008bbaf47b
commit
b31b4bf099
@ -153,7 +153,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "cache-from",
|
Name: "cache-from",
|
||||||
Usage: "cache from",
|
Usage: "images to consider as cache sources",
|
||||||
EnvVar: "PLUGIN_CACHE_FROM",
|
EnvVar: "PLUGIN_CACHE_FROM",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
|
18
docker.go
18
docker.go
@ -105,15 +105,6 @@ func (p Plugin) Exec() error {
|
|||||||
fmt.Println("Registry credentials not provided. Guest mode enabled.")
|
fmt.Println("Registry credentials not provided. Guest mode enabled.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-pull cache image
|
|
||||||
for _, img := range p.Build.CacheFrom {
|
|
||||||
cmd := commandPull(img)
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
trace(cmd)
|
|
||||||
cmd.Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.Build.Squash && !p.Daemon.Experimental {
|
if p.Build.Squash && !p.Daemon.Experimental {
|
||||||
fmt.Println("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring...")
|
fmt.Println("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring...")
|
||||||
p.Build.Squash = false
|
p.Build.Squash = false
|
||||||
@ -126,6 +117,11 @@ func (p Plugin) Exec() error {
|
|||||||
cmds = append(cmds, commandVersion()) // docker version
|
cmds = append(cmds, commandVersion()) // docker version
|
||||||
cmds = append(cmds, commandInfo()) // docker info
|
cmds = append(cmds, commandInfo()) // docker info
|
||||||
|
|
||||||
|
// pre-pull cache images
|
||||||
|
for _, img := range p.Build.CacheFrom {
|
||||||
|
cmds = append(cmds, commandPull(img))
|
||||||
|
}
|
||||||
|
|
||||||
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
||||||
|
|
||||||
for _, tag := range p.Build.Tags {
|
for _, tag := range p.Build.Tags {
|
||||||
@ -148,7 +144,9 @@ func (p Plugin) Exec() error {
|
|||||||
trace(cmd)
|
trace(cmd)
|
||||||
|
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil && cmd.Args[1] == "pull" {
|
||||||
|
fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2])
|
||||||
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user