@@ -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
@@ -137,16 +136,26 @@ manifests: controller-gen ## Generate CustomResourceDefinition objects.
137
136
generate-code : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
138
137
$(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate/boilerplate.go.txt" paths=" ./pkg/apis/..."
139
138
139
+ # Build the docker image and tag it.
140
140
images : verify-tag-name generate-code update-deployment-crds
141
141
$(info List executable directory)
142
142
$(info repo id: ${git_repository_id})
143
143
$(info branch: ${GIT_BRANCH})
144
144
$(info Build the docker image)
145
- ifeq ($(strip $(GO_BUILD_ARGS ) ) ,)
146
- docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
147
- else
148
- docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
149
- endif
145
+ @HOST_ARCH=$$(uname -m ) ; \
146
+ if [ " $$ HOST_ARCH" = " aarch64" ]; then \
147
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
148
+ docker buildx build --quiet --no-cache --platform=linux/amd64 --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
149
+ else \
150
+ 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} ; \
151
+ fi \
152
+ else \
153
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
154
+ docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
155
+ else \
156
+ docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
157
+ fi \
158
+ fi
150
159
151
160
images-podman : verify-tag-name generate-code update-deployment-crds
152
161
$(info List executable directory)
0 commit comments