Skip to content

Commit 9e2f77f

Browse files
authored
fix: πŸ› a better fix for #1635 (#1656)
* fix: πŸ› a better fix for #1635 Signed-off-by: EduarteXD <i@m.oxdl.cn> * fix: πŸ› this should not be modified Signed-off-by: EduarteXD <i@m.oxdl.cn> --------- Signed-off-by: EduarteXD <i@m.oxdl.cn>
1 parent 5c75010 commit 9e2f77f

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

β€Žpkg/docker/build.goβ€Ž

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ func Build(dir, dockerfile, imageName string, secrets []string, noCache bool, pr
1717
var args []string
1818

1919
args = append(args,
20-
"buildx", "build", "--load",
20+
"buildx", "build",
2121
)
2222

2323
if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) {
2424
// Fixes "WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested"
25-
args = append(args, "--platform", "linux/amd64")
25+
args = append(args, "--platform", "linux/amd64", "--load")
2626
}
2727

2828
for _, secret := range secrets {
@@ -71,16 +71,16 @@ func Build(dir, dockerfile, imageName string, secrets []string, noCache bool, pr
7171
return cmd.Run()
7272
}
7373

74-
func BuildAddLabelsAndSchemaToImage(dir, image string, labels map[string]string, bundledSchemaFile string, bundledSchemaPy string) error {
74+
func BuildAddLabelsAndSchemaToImage(image string, labels map[string]string, bundledSchemaFile string, bundledSchemaPy string) error {
7575
var args []string
7676

7777
args = append(args,
78-
"buildx", "build", "--load",
78+
"buildx", "build",
7979
)
8080

8181
if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) {
8282
// Fixes "WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested"
83-
args = append(args, "--platform", "linux/amd64")
83+
args = append(args, "--platform", "linux/amd64", "--load")
8484
}
8585

8686
args = append(args,
@@ -95,7 +95,6 @@ func BuildAddLabelsAndSchemaToImage(dir, image string, labels map[string]string,
9595
// We're not using context, but Docker requires we pass a context
9696
args = append(args, ".")
9797
cmd := exec.Command("docker", args...)
98-
cmd.Dir = dir
9998

10099
dockerfile := "FROM " + image + "\n"
101100
dockerfile += "COPY " + bundledSchemaFile + " .cog\n"

β€Žpkg/image/build.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func Build(cfg *config.Config, dir, imageName string, secrets []string, noCache,
210210
}
211211
}
212212

213-
if err := docker.BuildAddLabelsAndSchemaToImage(dir, imageName, labels, bundledSchemaFile, bundledSchemaPy); err != nil {
213+
if err := docker.BuildAddLabelsAndSchemaToImage(imageName, labels, bundledSchemaFile, bundledSchemaPy); err != nil {
214214
return fmt.Errorf("Failed to add labels to image: %w", err)
215215
}
216216
return nil

0 commit comments

Comments
Β (0)