From a5124d90e2216a7693b401d1c177f3fe8434a63e Mon Sep 17 00:00:00 2001 From: Megha-Rajanna <62827113+Megha-Rajanna@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:39:07 +0530 Subject: [PATCH 1/3] Update Makefile Signed-off-by: Megha-Rajanna --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0017afbb..9b00bd03 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,12 @@ GOBIN=$(shell go env GOPATH)/bin else GOBIN=$(shell go env GOBIN) endif +#Setting the java based on the architecture +ifeq ($(shell uname -m), s390x) +JAVA_TYPE="ibmjava" +else +JAVA_TYPE="openjdk" +endif # Install CRDs into a cluster install: manifests kustomize @@ -128,6 +134,12 @@ build-go: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \ -ldflags "-X github.com/$(REPO)/pkg/version.Version=$(VERSION) -X github.com/$(REPO)/pkg/version.GitSHA=$(GIT_SHA)" \ -o bin/$(EXPORTER_NAME)-windows-amd64.exe cmd/exporter/main.go + CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build \ + -ldflags "-X github.com/$(REPO)/pkg/version.Version=$(VERSION) -X github.com/$(REPO)/pkg/version.GitSHA=$(GIT_SHA)" \ + -o bin/$(PROJECT_NAME)-linux-s390x main.go + CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build \ + -ldflags "-X github.com/$(REPO)/pkg/version.Version=$(VERSION) -X github.com/$(REPO)/pkg/version.GitSHA=$(GIT_SHA)" \ + -o bin/$(EXPORTER_NAME)-linux-s390x cmd/exporter/main.go build-image: docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(REPO):$(VERSION) . @@ -135,7 +147,7 @@ build-image: build-zk-image: - docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker + docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg JAVA_TYPE=$(JAVA_TYPE) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest build-zk-image-swarm: From f46f7233fd6b79e9db43792e2b443916f9fff1c3 Mon Sep 17 00:00:00 2001 From: Megha-Rajanna <62827113+Megha-Rajanna@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:40:00 +0530 Subject: [PATCH 2/3] Update Dockerfile Signed-off-by: Megha-Rajanna --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b5813dd1..121aa265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ ARG DOCKER_REGISTRY ARG DISTROLESS_DOCKER_REGISTRY ARG ALPINE_VERSION=3.18 +ARG TARGETARCH FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.21-alpine${ALPINE_VERSION} as go-builder ARG PROJECT_NAME=zookeeper-operator @@ -26,7 +27,7 @@ COPY api/ api/ COPY controllers/ controllers/ # Build -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ +RUN GOOS=linux GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ -ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" main.go FROM ${DISTROLESS_DOCKER_REGISTRY:-gcr.io/}distroless/static-debian11:nonroot AS final From 3d798eb844ebde7c5b688df58814a9375811d19b Mon Sep 17 00:00:00 2001 From: Megha-Rajanna <62827113+Megha-Rajanna@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:40:49 +0530 Subject: [PATCH 3/3] Update Dockerfile Signed-off-by: Megha-Rajanna --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 368f7a9d..2c9b9659 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,7 +9,8 @@ # ARG DOCKER_REGISTRY -FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}openjdk:11-jdk +ARG JAVA_TYPE +FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}${JAVA_TYPE:+$JAVA_TYPE}:11-jdk RUN mkdir /zu COPY zu /zu WORKDIR /zu