You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-15 01:34:21 +02:00
fix: use default builder with buildx (#3199)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@ -61,7 +61,7 @@ func (i dockerImager) Build(ctx *context.Context, root string, images, flags []s
|
|||||||
func (i dockerImager) buildCommand(images, flags []string) []string {
|
func (i dockerImager) buildCommand(images, flags []string) []string {
|
||||||
base := []string{"build", "."}
|
base := []string{"build", "."}
|
||||||
if i.buildx {
|
if i.buildx {
|
||||||
base = []string{"buildx", "build", ".", "--load"}
|
base = []string{"buildx", "--builder", "default", "build", ".", "--load"}
|
||||||
}
|
}
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
base = append(base, "-t", image)
|
base = append(base, "-t", image)
|
||||||
|
@ -1122,7 +1122,7 @@ func TestBuildCommand(t *testing.T) {
|
|||||||
name: "buildx",
|
name: "buildx",
|
||||||
buildx: true,
|
buildx: true,
|
||||||
flags: []string{"--label=foo", "--build-arg=bar=baz"},
|
flags: []string{"--label=foo", "--build-arg=bar=baz"},
|
||||||
expect: []string{"buildx", "build", ".", "--load", "-t", images[0], "-t", images[1], "--label=foo", "--build-arg=bar=baz"},
|
expect: []string{"buildx", "--builder", "default", "build", ".", "--load", "-t", images[0], "-t", images[1], "--label=foo", "--build-arg=bar=baz"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -240,6 +240,27 @@ docker build -t myuser/myimage . \
|
|||||||
!!! tip
|
!!! tip
|
||||||
Learn more about the [name template engine](/customization/templates/).
|
Learn more about the [name template engine](/customization/templates/).
|
||||||
|
|
||||||
|
## Use a specific builder with Docker buildx
|
||||||
|
|
||||||
|
If `buildx` is enabled, the `default` context builder will be used when building
|
||||||
|
the image. This builder is always available and backed by BuildKit in the
|
||||||
|
Docker engine. If you want to use a different builder, you can specify it using
|
||||||
|
the `build_flag_templates` field:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# .goreleaser.yaml
|
||||||
|
dockers:
|
||||||
|
-
|
||||||
|
image_templates:
|
||||||
|
- "myuser/myimage"
|
||||||
|
use: buildx
|
||||||
|
build_flag_templates:
|
||||||
|
- "--builder=mybuilder"
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Learn more about the [buildx builder instances](https://docs.docker.com/buildx/working-with-buildx/#work-with-builder-instances).
|
||||||
|
|
||||||
## Podman
|
## Podman
|
||||||
|
|
||||||
!!! success "GoReleaser Pro"
|
!!! success "GoReleaser Pro"
|
||||||
|
Reference in New Issue
Block a user