Skip to content

Commit

Permalink
Create image tags at build time
Browse files Browse the repository at this point in the history
  • Loading branch information
Kévin Darcel committed Mar 7, 2018
1 parent 1e396b3 commit 977f0d2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ func (p Plugin) Exec() error {

cmds = append(cmds, commandBuild(p.Build)) // docker build

for _, tag := range p.Build.Tags {
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag

if p.Dryrun == false {
if p.Dryrun == false {
for _, tag := range p.Build.Tags {
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
}
}
Expand Down Expand Up @@ -187,10 +185,14 @@ func commandBuild(build Build) *exec.Cmd {
"build",
"--rm=true",
"-f", build.Dockerfile,
"-t", build.Name,
}

for _, tag := range build.Tags {
args = append(args, "-t", tag)
}

args = append(args, build.Context)

if build.Squash {
args = append(args, "--squash")
}
Expand Down

0 comments on commit 977f0d2

Please sign in to comment.