Skip to content

Commit

Permalink
Combine build and push in a single step.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolftimmermans committed Nov 13, 2024
1 parent 6a94d1c commit deeeeb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v2.5.4

* Combine build and push in a single step.

# v2.5.3

* Increase compatibility with older docker clients.
Expand Down
5 changes: 1 addition & 4 deletions pkg/build/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ func Run(log *util.Logger, app *config.ResolvedApp, buildCacheTag string) error
log.Fatal(err)
}

log.Note("Pushing to", app.Repository())
if err := docker.Push(log, app); err != nil {
log.Fatal(err)
}
log.Note("Pushed to", app.Repository())

if app.PostBuild != "" {
err := util.Run(log, "sh", "-c", app.PostBuild)
Expand Down
9 changes: 1 addition & 8 deletions pkg/internal/docker/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,14 @@ func Build(log *util.Logger, app *config.ResolvedApp, buildCacheTag string) erro

return util.Run(log,
"docker", append(cmd,
"--output=type=image",
"--output=type=image,name="+app.Repository()+",push=true",
"--file", dockerfile,
"--tag", app.Repository(),
"--platform", app.Platform,
app.Root,
)...)
}

func Push(log *util.Logger, app *config.ResolvedApp) error {
return util.Run(log,
"docker",
"push", app.Repository(),
)
}

func supportsCacheExport(log *util.Logger) bool {
output, err := util.Capture(log, "docker", "buildx", "inspect", "--debug")
if err != nil {
Expand Down

0 comments on commit deeeeb4

Please sign in to comment.