@@ -165,16 +165,28 @@ ${BIN_DIR}/deepcopy-gen:
165
165
$(info Compiling deepcopy-gen...)
166
166
go build -o ${BIN_DIR} /deepcopy-gen ./cmd/deepcopy-gen/
167
167
168
+
169
+ # Build the docker image and tag it.
168
170
images : verify-tag-name generate-code update-deployment-crds
169
171
$(info List executable directory)
170
172
$(info repo id: ${git_repository_id})
171
173
$(info branch: ${GIT_BRANCH})
172
174
$(info Build the docker image)
173
- ifeq ($(strip $(GO_BUILD_ARGS ) ) ,)
174
- docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
175
- else
176
- docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
177
- endif
175
+ echo " Host architecture: $( shell uname -m) "
176
+ @HOST_ARCH=$(shell uname -m) ; \
177
+ if [ " $$ HOST_ARCH" = " arm64" ]; then \
178
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
179
+ docker buildx build --platform linux/amd64 --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
180
+ else \
181
+ 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} ; \
182
+ fi \
183
+ else \
184
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
185
+ docker build --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
186
+ else \
187
+ docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
188
+ fi \
189
+ fi
178
190
179
191
images-podman : verify-tag-name generate-code update-deployment-crds
180
192
$(info List executable directory)
0 commit comments