From d85e7ee648b12f840a13c7c0ce75c2cbf5e667a5 Mon Sep 17 00:00:00 2001 From: EduarteXD Date: Sat, 11 May 2024 05:43:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20a=20better=20fix=20fo?= =?UTF-8?q?r=20#1635?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: EduarteXD --- Makefile | 2 +- pkg/docker/build.go | 11 +++++------ pkg/image/build.go | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 6e2a6a9018..5c3a7c246b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ GO ?= go GOOS := $(shell $(GO) env GOOS) GOARCH := $(shell $(GO) env GOARCH) -PYTHON ?= python +PYTHON ?= python3 PYTEST := $(PYTHON) -m pytest PYRIGHT := $(PYTHON) -m pyright RUFF := $(PYTHON) -m ruff diff --git a/pkg/docker/build.go b/pkg/docker/build.go index 00fdd6f48c..ebfabfa7a4 100644 --- a/pkg/docker/build.go +++ b/pkg/docker/build.go @@ -17,12 +17,12 @@ func Build(dir, dockerfile, imageName string, secrets []string, noCache bool, pr var args []string args = append(args, - "buildx", "build", "--load", + "buildx", "build", ) if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) { // 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" - args = append(args, "--platform", "linux/amd64") + args = append(args, "--platform", "linux/amd64", "--load") } for _, secret := range secrets { @@ -71,16 +71,16 @@ func Build(dir, dockerfile, imageName string, secrets []string, noCache bool, pr return cmd.Run() } -func BuildAddLabelsAndSchemaToImage(dir, image string, labels map[string]string, bundledSchemaFile string, bundledSchemaPy string) error { +func BuildAddLabelsAndSchemaToImage(image string, labels map[string]string, bundledSchemaFile string, bundledSchemaPy string) error { var args []string args = append(args, - "buildx", "build", "--load", + "buildx", "build", ) if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) { // 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" - args = append(args, "--platform", "linux/amd64") + args = append(args, "--platform", "linux/amd64", "--load") } args = append(args, @@ -95,7 +95,6 @@ func BuildAddLabelsAndSchemaToImage(dir, image string, labels map[string]string, // We're not using context, but Docker requires we pass a context args = append(args, ".") cmd := exec.Command("docker", args...) - cmd.Dir = dir dockerfile := "FROM " + image + "\n" dockerfile += "COPY " + bundledSchemaFile + " .cog\n" diff --git a/pkg/image/build.go b/pkg/image/build.go index a3cffe423a..8d3fd76c00 100644 --- a/pkg/image/build.go +++ b/pkg/image/build.go @@ -170,7 +170,7 @@ func Build(cfg *config.Config, dir, imageName string, secrets []string, noCache, } } - if err := docker.BuildAddLabelsAndSchemaToImage(dir, imageName, labels, bundledSchemaFile, bundledSchemaPy); err != nil { + if err := docker.BuildAddLabelsAndSchemaToImage(imageName, labels, bundledSchemaFile, bundledSchemaPy); err != nil { return fmt.Errorf("Failed to add labels to image: %w", err) } return nil From 2cb62923920d773d290acbb38bbea9d98b40fb04 Mon Sep 17 00:00:00 2001 From: EduarteXD Date: Sat, 11 May 2024 06:00:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20this=20should=20not?= =?UTF-8?q?=20be=20modified?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: EduarteXD --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c3a7c246b..6e2a6a9018 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ GO ?= go GOOS := $(shell $(GO) env GOOS) GOARCH := $(shell $(GO) env GOARCH) -PYTHON ?= python3 +PYTHON ?= python PYTEST := $(PYTHON) -m pytest PYRIGHT := $(PYTHON) -m pyright RUFF := $(PYTHON) -m ruff