diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 4b4edbb..636a625 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -202,6 +202,11 @@ func main() { Usage: "repository default branch", EnvVar: "DRONE_REPO_BRANCH", }, + cli.BoolFlag{ + Name: "no-cache", + Usage: "do not use cached intermediate containers", + EnvVar: "PLUGIN_NO_CACHE", + }, } if err := app.Run(os.Args); err != nil { @@ -232,6 +237,7 @@ func run(c *cli.Context) error { Compress: c.Bool("compress"), Repo: c.String("repo"), LabelSchema: c.StringSlice("label-schema"), + NoCache: c.Bool("no-cache"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), diff --git a/docker.go b/docker.go index 229a1d0..7990de0 100644 --- a/docker.go +++ b/docker.go @@ -49,6 +49,7 @@ type ( Compress bool // Docker build compress Repo string // Docker build repository LabelSchema []string // Label schema map + NoCache bool // Docker build no-cache } // Plugin defines the Docker plugin parameters. @@ -198,6 +199,9 @@ func commandBuild(build Build) *exec.Cmd { if build.Pull { args = append(args, "--pull=true") } + if build.NoCache { + args = append(args, "--no-cache") + } for _, arg := range build.ArgsEnv { addProxyValue(&build, arg) }