From f4756f8e398130793f2d826733f33880ca0d783e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ke=CC=81vin=20Darcel?= Date: Fri, 27 Jan 2017 12:04:55 -0600 Subject: [PATCH] Support --compress docker build flag --- main.go | 6 ++++++ plugin.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/main.go b/main.go index 5969295..6e61c7a 100644 --- a/main.go +++ b/main.go @@ -118,6 +118,11 @@ func main() { Usage: "squash the layers at build time", EnvVar: "PLUGIN_SQUASH", }, + cli.BoolFlag{ + Name: "compress", + Usage: "compress the build context using gzip", + EnvVar: "PLUGIN_COMPRESS", + }, cli.StringFlag{ Name: "repo", Usage: "docker repository", @@ -167,6 +172,7 @@ func run(c *cli.Context) error { Tags: c.StringSlice("tags"), Args: c.StringSlice("args"), Squash: c.Bool("squash"), + Compress: c.Bool("compress"), Repo: c.String("repo"), }, Daemon: Daemon{ diff --git a/plugin.go b/plugin.go index fbfbc0a..7a79dc4 100644 --- a/plugin.go +++ b/plugin.go @@ -47,6 +47,7 @@ type ( Tags []string // Docker build tags Args []string // Docker build args Squash bool // Docker build squash + Compress bool // Docker build compress Repo string // Docker build repository } @@ -195,6 +196,9 @@ func commandBuild(build Build) *exec.Cmd { if build.Squash { args = append(args, "--squash") } + if build.Compress { + args = append(args, "--compress") + } for _, arg := range build.Args { args = append(args, "--build-arg", arg) }