Skip to content

Commit

Permalink
ci: Push Docker image directly on build
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnatamo committed Jul 27, 2024
1 parent 6fb4236 commit ad4570d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions .build/Build.Docker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ partial class Build : NukeBuild
Target BuildImage => _ => _
.DependsOn(Test)
.DependsOn(Format)
.Requires(() => this.GithubToken)
.Executes(() =>
DockerBuildxBuild(x => x
.SetPath(".")
.SetFile("Dockerfile")
.SetTag(this.DockerImageTag)
.SetPlatform(string.Join(",", this.DockerImagePlatforms))
.SetPush(true)
.AddCacheFrom("type=gha")
.AddCacheTo("type=gha,mode=max")
.AddLabel("org.opencontainers.image.source=https://github.com/fetcharr/fetcharr")
Expand All @@ -44,11 +46,4 @@ partial class Build : NukeBuild
Log.Information(output);
}
})));

Target PushImage => _ => _
.DependsOn(BuildImage)
.Requires(() => this.GithubToken)
.Executes(() =>
DockerImagePush(x => x
.SetName(this.DockerImageTag)));
}
1 change: 0 additions & 1 deletion .build/Build.Release.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ partial class Build : NukeBuild

Target Release => _ => _
.DependsOn(BuildImage)
.Triggers(PushImage)
.Requires(() => this.GithubToken)
.Executes(async () =>
{
Expand Down

0 comments on commit ad4570d

Please sign in to comment.