Skip to content

Commit ae0dd26

Browse files
(fix) : Makefile docker build command by removing platform-specific setup
- Updated `docker-build` to remove platform-specific configurations, making it architecture-agnostic. - The command now builds according to the local environment's architecture without specifying `GOOS` or `GOARCH`. - Simplifies the Makefile by removing unnecessary exports for platform-specific builds, allowing compatibility across both Linux and macOS without manual adjustments. Note that when we run `make docker-build` it is not working. It fails with the error: ``` Error: ) $ make build docker-build /Users/camiladeomacedo/go/bin/controller-gen-v0.16.1 rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/base/rbac /Users/camiladeomacedo/go/bin/controller-gen-v0.16.1 object:headerFile="hack/boilerplate.go.txt" paths="./..." go fmt ./... go vet -tags 'containers_image_openpgp' ./... ``` This change ensures that the docker build will build the binary according to the local architecture and not for a specific ARCH. It simplifies the Makefile and logic to build.
1 parent 5076adb commit ae0dd26

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,12 @@ build: build-deps go-build-local #HELP Build manager binary for current GOOS and
269269
go-build-local: BUILDBIN := bin
270270
go-build-local: $(BINARIES)
271271

272-
.PHONY: build-linux go-build-linux
273-
build-linux: build-deps go-build-linux #EXHELP Build manager binary for GOOS=linux and local GOARCH.
274-
go-build-linux: BUILDBIN := bin/linux
275-
go-build-linux: export GOOS=linux
276-
go-build-linux: export GOARCH=amd64
277-
go-build-linux: $(BINARIES)
278-
279272
.PHONY: run
280273
run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster.
281274

282275
.PHONY: docker-build
283-
docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
284-
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
276+
docker-build: build #EXHELP Build the operator-controller manager with local GOOS/GOARCH
277+
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/
285278

286279
#SECTION Release
287280
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)

0 commit comments

Comments
 (0)