Skip to content

Commit

Permalink
Allow tagging built images in docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinChartier committed Jul 9, 2019
1 parent 7ee2727 commit c62ca8f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ func buildCommandAction(cliContext *cli.Context) error {
return cli.NewExitError(err.Error(), 1)
}

buildTag, err := git.GetCurrentTreeHash(buildRoot, services...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
buildTag := cliContext.String("tag")
if buildTag == "" {
buildTag, err = git.GetCurrentTreeHash(buildRoot, services...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
}

buildInterface := createBuildInterface(cliContext.Bool("plaintext"))
Expand Down Expand Up @@ -146,6 +149,10 @@ var buildCommand = cli.Command{
Name: "push",
Usage: "pushes to the configured registry for the current environment instead of loading locally",
},
cli.StringFlag{
Name: "tag,t",
Usage: "sets the tag of all built images to the specified one",
},
cli.BoolFlag{
Name: "verbose",
Usage: "enables verbose logging, mostly for sanic development",
Expand Down

0 comments on commit c62ca8f

Please sign in to comment.