@@ -3,7 +3,6 @@ CAT_CMD=$(if $(filter $(OS),Windows_NT),type,cat)
3
3
RELEASE_VER: =
4
4
CURRENT_DIR =$(shell pwd)
5
5
GIT_BRANCH: =$(shell git symbolic-ref --short HEAD 2>&1 | grep -v fatal)
6
-
7
6
# define the GO_BUILD_ARGS if you need to pass additional arguments to the go build
8
7
GO_BUILD_ARGS? =
9
8
@@ -150,16 +149,26 @@ manifests: controller-gen ## Generate CustomResourceDefinition objects.
150
149
generate-code : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
151
150
$(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate/boilerplate.go.txt" paths=" ./pkg/apis/..."
152
151
152
+ # Build the docker image and tag it.
153
153
images : verify-tag-name generate-code update-deployment-crds
154
154
$(info List executable directory)
155
155
$(info repo id: ${git_repository_id})
156
156
$(info branch: ${GIT_BRANCH})
157
157
$(info Build the docker image)
158
- ifeq ($(strip $(GO_BUILD_ARGS ) ) ,)
159
- docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
160
- else
161
- docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
162
- endif
158
+ @HOST_ARCH=$$(uname -m ) ; \
159
+ if [ " $$ HOST_ARCH" = " aarch64" ]; then \
160
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
161
+ docker buildx build --quiet --no-cache --platform=linux/amd64 --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
162
+ else \
163
+ docker buildx build --no-cache --platform=linux/amd64 --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
164
+ fi \
165
+ else \
166
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
167
+ docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
168
+ else \
169
+ docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
170
+ fi \
171
+ fi
163
172
164
173
images-podman : verify-tag-name generate-code update-deployment-crds
165
174
$(info List executable directory)
0 commit comments