@@ -3,6 +3,7 @@ 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
+ ARCH := $(shell uname -m)
6
7
# define the GO_BUILD_ARGS if you need to pass additional arguments to the go build
7
8
GO_BUILD_ARGS? =
8
9
@@ -76,16 +77,49 @@ ${BIN_DIR}/deepcopy-gen:
76
77
$(info Compiling deepcopy-gen...)
77
78
go build -o ${BIN_DIR} /deepcopy-gen ./cmd/deepcopy-gen/
78
79
80
+ # Build the docker image and tag it.
81
+ # images: verify-tag-name generate-code update-deployment-crds
82
+ # $(info List executable directory)
83
+ # $(info repo id: ${git_repository_id})
84
+ # $(info branch: ${GIT_BRANCH})
85
+ # $(info Build the docker image)
86
+ # ARCH := $(shell uname -m)
87
+ # ifeq ($(ARCH),aarch64)
88
+ # ifeq ($(strip $(GO_BUILD_ARGS)),)
89
+ # docker buildx build --quiet --no-cache --platform=linux/amd64 --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
90
+ # else
91
+ # 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}
92
+ # endif
93
+ # else
94
+ # ifeq ($(strip $(GO_BUILD_ARGS)),)
95
+ # docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
96
+ # else
97
+ # docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
98
+ # endif
99
+ # endif
100
+
101
+
102
+ # Build the docker image and tag it.
79
103
images : verify-tag-name generate-code update-deployment-crds
80
104
$(info List executable directory)
81
105
$(info repo id: ${git_repository_id})
82
106
$(info branch: ${GIT_BRANCH})
83
107
$(info Build the docker image)
84
- ifeq ($(strip $(GO_BUILD_ARGS ) ) ,)
85
- docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
86
- else
87
- docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
88
- endif
108
+ @HOST_ARCH=$$(uname -m ) ; \
109
+ if [ " $$ HOST_ARCH" = " aarch64" ]; then \
110
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
111
+ docker buildx build --quiet --no-cache --platform=linux/amd64 --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
112
+ else \
113
+ 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} ; \
114
+ fi \
115
+ else \
116
+ if [ " $( strip $( GO_BUILD_ARGS) ) " = " " ]; then \
117
+ docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
118
+ else \
119
+ docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS ) -f ${CURRENT_DIR} /Dockerfile ${CURRENT_DIR} ; \
120
+ fi \
121
+ fi
122
+
89
123
90
124
images-podman : verify-tag-name generate-code update-deployment-crds
91
125
$(info List executable directory)
@@ -158,4 +192,4 @@ ${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml : ${CRD_BASE_DIR}/mcad.i
158
192
159
193
160
194
$(DEPLOYMENT_CRD_DIR ) /% : ${CRD_BASE_DIR}/%
161
- cp $< $@
195
+ cp $< $@
0 commit comments