Skip to content

Commit

Permalink
Merge pull request #110 from JeffDownie/allow_using_cached_base_image
Browse files Browse the repository at this point in the history
allowing docker to use cached base image in build
  • Loading branch information
bradrydzewski authored Feb 21, 2017
2 parents 0d98008 + 8551bcc commit f606fcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func main() {
Usage: "squash the layers at build time",
EnvVar: "PLUGIN_SQUASH",
},
cli.BoolTFlag{
Name: "pull-image",
Usage: "force pull base image at build time",
EnvVar: "PLUGIN_PULL_IMAGE",
},
cli.BoolFlag{
Name: "compress",
Usage: "compress the build context using gzip",
Expand Down Expand Up @@ -172,6 +177,7 @@ func run(c *cli.Context) error {
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Squash: c.Bool("squash"),
Pull: c.BoolT("pull-image"),
Compress: c.Bool("compress"),
Repo: c.String("repo"),
},
Expand Down
7 changes: 5 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type (
Tags []string // Docker build tags
Args []string // Docker build args
Squash bool // Docker build squash
Pull bool // Docker build pull
Compress bool // Docker build compress
Repo string // Docker build repository
}
Expand Down Expand Up @@ -185,9 +186,8 @@ func commandInfo() *exec.Cmd {

// helper function to create the docker build command.
func commandBuild(build Build) *exec.Cmd {
args := []string {
args := []string{
"build",
"--pull=true",
"--rm=true",
"-f", build.Dockerfile,
"-t", build.Name,
Expand All @@ -200,6 +200,9 @@ func commandBuild(build Build) *exec.Cmd {
if build.Compress {
args = append(args, "--compress")
}
if build.Pull {
args = append(args, "--pull=true")
}
for _, arg := range build.Args {
args = append(args, "--build-arg", arg)
}
Expand Down

0 comments on commit f606fcf

Please # to comment.