mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-28 18:20:35 +00:00
allowing docker to use cached base image in build
This commit is contained in:
parent
0d98008242
commit
5d96ed01d2
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,3 +26,6 @@ _testmain.go
|
|||||||
|
|
||||||
coverage.out
|
coverage.out
|
||||||
drone-docker
|
drone-docker
|
||||||
|
|
||||||
|
# IDE/Editor related files
|
||||||
|
**.swp
|
||||||
|
6
main.go
6
main.go
@ -118,6 +118,11 @@ func main() {
|
|||||||
Usage: "squash the layers at build time",
|
Usage: "squash the layers at build time",
|
||||||
EnvVar: "PLUGIN_SQUASH",
|
EnvVar: "PLUGIN_SQUASH",
|
||||||
},
|
},
|
||||||
|
cli.BoolTFlag{
|
||||||
|
Name: "cache",
|
||||||
|
Usage: "don't attempt to re-build layers of the image that already exist",
|
||||||
|
EnvVar: "PLUGIN_USE_CACHE",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "compress",
|
Name: "compress",
|
||||||
Usage: "compress the build context using gzip",
|
Usage: "compress the build context using gzip",
|
||||||
@ -172,6 +177,7 @@ func run(c *cli.Context) error {
|
|||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
Squash: c.Bool("squash"),
|
Squash: c.Bool("squash"),
|
||||||
|
Cache: c.Bool("cache"),
|
||||||
Compress: c.Bool("compress"),
|
Compress: c.Bool("compress"),
|
||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
},
|
},
|
||||||
|
@ -47,6 +47,7 @@ type (
|
|||||||
Tags []string // Docker build tags
|
Tags []string // Docker build tags
|
||||||
Args []string // Docker build args
|
Args []string // Docker build args
|
||||||
Squash bool // Docker build squash
|
Squash bool // Docker build squash
|
||||||
|
Cache bool // Docker build without pulling
|
||||||
Compress bool // Docker build compress
|
Compress bool // Docker build compress
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
}
|
}
|
||||||
@ -187,7 +188,6 @@ func commandInfo() *exec.Cmd {
|
|||||||
func commandBuild(build Build) *exec.Cmd {
|
func commandBuild(build Build) *exec.Cmd {
|
||||||
args := []string {
|
args := []string {
|
||||||
"build",
|
"build",
|
||||||
"--pull=true",
|
|
||||||
"--rm=true",
|
"--rm=true",
|
||||||
"-f", build.Dockerfile,
|
"-f", build.Dockerfile,
|
||||||
"-t", build.Name,
|
"-t", build.Name,
|
||||||
@ -200,6 +200,11 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
if build.Compress {
|
if build.Compress {
|
||||||
args = append(args, "--compress")
|
args = append(args, "--compress")
|
||||||
}
|
}
|
||||||
|
if build.Cache {
|
||||||
|
args = append(args, "--pull=false")
|
||||||
|
} else {
|
||||||
|
args = append(args, "--pull=true")
|
||||||
|
}
|
||||||
for _, arg := range build.Args {
|
for _, arg := range build.Args {
|
||||||
args = append(args, "--build-arg", arg)
|
args = append(args, "--build-arg", arg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user