Skip to content

Commit f2a2cb3

Browse files
committed
build and push in one go; switch up compression level
1 parent 026a836 commit f2a2cb3

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

docker.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,20 @@ func (p Plugin) Exec() error {
209209
}
210210
}
211211

212-
cmds = append(cmds, commandBuild(p.Build)) // docker build
213-
212+
// XXX Dryrun mode is broken now
214213
for _, tag := range p.Build.Tags {
215-
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag
214+
cmds = append(cmds, commandBuild(p.Build, tag)) // docker build and push
215+
}
216+
217+
/*
218+
for _, tag := range p.Build.Tags {
219+
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag
216220
217-
if !p.Dryrun {
218-
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
221+
if !p.Dryrun {
222+
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
223+
}
219224
}
220-
}
225+
*/
221226

222227
// execute all commands in batch mode.
223228
for _, cmd := range cmds {
@@ -324,14 +329,15 @@ func commandInfo() *exec.Cmd {
324329
}
325330

326331
// helper function to create the docker build command.
327-
func commandBuild(build Build) *exec.Cmd {
332+
func commandBuild(build Build, tag string) *exec.Cmd {
333+
target := fmt.Sprintf("%s:%s", build.Repo, tag)
328334
args := []string{
329335
"build",
330336
"--rm=true",
331337
"-f", build.Dockerfile,
332-
"-t", build.TempTag,
338+
"-t", target,
333339
// experiment to make go fast
334-
"--output=type=image,compression=zstd,compression-level=-7",
340+
"--output=type=image,compression=zstd,compression-level=3,force-compression=true,push=true",
335341
}
336342

337343
args = append(args, build.Context)

0 commit comments

Comments
 (0)