@@ -91,16 +91,28 @@ ${BIN_DIR}/deepcopy-gen:
91
91
$(info Compiling deepcopy-gen...)
92
92
go build -o ${BIN_DIR} /deepcopy-gen ./cmd/deepcopy-gen/
93
93
94
+
95
+ # Build the docker image and tag it.
94
96
images : verify-tag-name generate-code update-deployment-crds
95
97
$(info List executable directory)
96
98
$(info repo id: ${git_repository_id})
97
99
$(info branch: ${GIT_BRANCH})
98
100
$(info Build the docker image)
99
- ifeq ($(strip $(GO_BUILD_ARGS ) ) ,)
100
- docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
101
- else
102
- docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
103
- endif
101
+ echo " Host architecture: $( shell uname -m) "
102
+ @HOST_ARCH=$(shell uname -m) ; \
103
+ if [ " $$ HOST_ARCH" = " arm64" ]; then \
104
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
105
+ docker buildx build --platform linux/amd64 --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
106
+ else \
107
+ docker buildx build --platform linux/amd64 --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
108
+ fi \
109
+ else \
110
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
111
+ docker build --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
112
+ else \
113
+ docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
114
+ fi \
115
+ fi
104
116
105
117
images-podman : verify-tag-name generate-code update-deployment-crds
106
118
$(info List executable directory)
0 commit comments