12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ # ARCH specifies the golang target platform, for docker build
16
+ # targetes. It is supported for backward compatibility, but prefer
17
+ # BUILDARCH and TARGETARCH.
15
18
ARCH ?= amd64
19
+ # BUILDARCH specifies the golang build platform, for docker build targets.
20
+ BUILDARCH ?= amd64
21
+ # TARGETARCH specifies the golang target platform, for docker build targets.
22
+ TARGETARCH ?= $(ARCH )
16
23
ARCH_LIST ?= amd64 arm arm64 ppc64le s390x
17
24
RELEASE_ARCH_LIST = amd64 arm64
18
25
# The output type could either be docker (local), or registry.
@@ -201,53 +208,53 @@ docker-push: docker-push/proxy-agent docker-push/proxy-server
201
208
.PHONY : docker-build/proxy-agent
202
209
docker-build/proxy-agent : cmd/agent/main.go proto/agent/agent.pb.go buildx-setup
203
210
@[ " ${TAG} " ] || ( echo " TAG is not set" ; exit 1 )
204
- echo " Building proxy-agent for ${ARCH } "
205
- ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(ARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg ARCH =$(ARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/agent-build.Dockerfile -t ${AGENT_FULL_IMAGE} -$(ARCH ) :${TAG}
211
+ echo " Building proxy-agent with ${BUILDARCH} for ${TARGETARCH } "
212
+ ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(TARGETARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg BUILDARCH =$(BUILDARCH ) --build-arg TARGETARCH= $( TARGETARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/agent-build.Dockerfile -t ${AGENT_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
206
213
207
214
.PHONY : docker-push/proxy-agent
208
215
docker-push/proxy-agent : docker-build/proxy-agent
209
216
@[ " ${DOCKER_CMD} " ] || ( echo " DOCKER_CMD is not set" ; exit 1 )
210
- ${DOCKER_CMD} push ${AGENT_FULL_IMAGE} -$(ARCH ) :${TAG}
217
+ ${DOCKER_CMD} push ${AGENT_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
211
218
212
219
.PHONY : docker-build/proxy-server
213
220
docker-build/proxy-server : cmd/server/main.go proto/agent/agent.pb.go buildx-setup
214
221
@[ " ${TAG} " ] || ( echo " TAG is not set" ; exit 1 )
215
- echo " Building proxy-server for ${ARCH } "
216
- ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(ARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg ARCH =$(ARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/server-build.Dockerfile -t ${SERVER_FULL_IMAGE} -$(ARCH ) :${TAG}
222
+ echo " Building proxy-server with ${BUILDARCH} for ${TARGETARCH } "
223
+ ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(TARGETARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg BUILDARCH =$(BUILDARCH ) --build-arg TARGETARCH= $( TARGETARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/server-build.Dockerfile -t ${SERVER_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
217
224
218
225
.PHONY : docker-push/proxy-server
219
226
docker-push/proxy-server : docker-build/proxy-server
220
227
@[ " ${DOCKER_CMD} " ] || ( echo " DOCKER_CMD is not set" ; exit 1 )
221
- ${DOCKER_CMD} push ${SERVER_FULL_IMAGE} -$(ARCH ) :${TAG}
228
+ ${DOCKER_CMD} push ${SERVER_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
222
229
223
230
.PHONY : docker-build/proxy-test-client
224
231
docker-build/proxy-test-client : cmd/test-client/main.go proto/agent/agent.pb.go buildx-setup
225
232
@[ " ${TAG} " ] || ( echo " TAG is not set" ; exit 1 )
226
- echo " Building proxy-test-client for ${ARCH } "
227
- ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(ARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg ARCH =$(ARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/test-client-build.Dockerfile -t ${TEST_CLIENT_FULL_IMAGE} -$(ARCH ) :${TAG}
233
+ echo " Building proxy-test-client with ${BUILDARCH} for ${TARGETARCH } "
234
+ ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(TARGETARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg BUILDARCH =$(BUILDARCH ) --build-arg TARGETARCH= $( TARGETARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/test-client-build.Dockerfile -t ${TEST_CLIENT_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
228
235
229
236
.PHONY : docker-push/proxy-test-client
230
237
docker-push/proxy-test-client : docker-build/proxy-test-client
231
238
@[ " ${DOCKER_CMD} " ] || ( echo " DOCKER_CMD is not set" ; exit 1 )
232
- ${DOCKER_CMD} push ${TEST_CLIENT_FULL_IMAGE} -$(ARCH ) :${TAG}
239
+ ${DOCKER_CMD} push ${TEST_CLIENT_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
233
240
234
241
.PHONY : docker-build/http-test-server
235
242
docker-build/http-test-server : cmd/test-server/main.go buildx-setup
236
243
@[ " ${TAG} " ] || ( echo " TAG is not set" ; exit 1 )
237
- echo " Building http-test-server for ${ARCH } "
238
- ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(ARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg ARCH =$(ARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/test-server-build.Dockerfile -t ${TEST_SERVER_FULL_IMAGE} -$(ARCH ) :${TAG}
244
+ echo " Building http-test-server with ${BUILDARCH} for ${TARGETARCH } "
245
+ ${DOCKER_CMD} buildx build . --pull --output=type=$(OUTPUT_TYPE ) --platform linux/$(TARGETARCH ) --build-arg GO_TOOLCHAIN=$(GO_TOOLCHAIN ) --build-arg GO_VERSION=$(GO_VERSION ) --build-arg BUILDARCH =$(BUILDARCH ) --build-arg TARGETARCH= $( TARGETARCH ) --build-arg BASEIMAGE=$(BASEIMAGE ) -f artifacts/images/test-server-build.Dockerfile -t ${TEST_SERVER_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
239
246
240
247
.PHONY : docker-push/http-test-server
241
248
docker-push/http-test-server : docker-build/http-test-server
242
249
@[ " ${DOCKER_CMD} " ] || ( echo " DOCKER_CMD is not set" ; exit 1 )
243
- ${DOCKER_CMD} push ${TEST_SERVER_FULL_IMAGE} -$(ARCH ) :${TAG}
250
+ ${DOCKER_CMD} push ${TEST_SERVER_FULL_IMAGE} -$(TARGETARCH ) :${TAG}
244
251
245
252
# # --------------------------------------
246
253
# # Docker — All ARCH
247
254
# # --------------------------------------
248
255
249
256
# As `docker buildx` is time and resource consuming, if not necessary, building specific arch images,
250
- # like `make docker-build-arch-aamd64 `, is recommended.
257
+ # like `make docker-build-arch-amd64 `, is recommended.
251
258
.PHONY : docker-build-all
252
259
docker-build-all : $(addprefix docker-build-arch-,$(ARCH_LIST ) )
253
260
@@ -261,16 +268,16 @@ docker-build-arch-%:
261
268
$(MAKE ) docker-build/proxy-server-$*
262
269
263
270
docker-build/proxy-agent-% :
264
- $(MAKE ) ARCH =$* docker-build/proxy-agent
271
+ $(MAKE ) TARGETARCH =$* docker-build/proxy-agent
265
272
266
273
docker-push/proxy-agent-% :
267
- $(MAKE ) ARCH =$* docker-push/proxy-agent
274
+ $(MAKE ) TARGETARCH =$* docker-push/proxy-agent
268
275
269
276
docker-build/proxy-server-% :
270
- $(MAKE ) ARCH =$* docker-build/proxy-server
277
+ $(MAKE ) TARGETARCH =$* docker-build/proxy-server
271
278
272
279
docker-push/proxy-server-% :
273
- $(MAKE ) ARCH =$* docker-push/proxy-server
280
+ $(MAKE ) TARGETARCH =$* docker-push/proxy-server
274
281
275
282
.PHONY : docker-push-manifest/proxy-agent
276
283
docker-push-manifest/proxy-agent : # # Push the fat manifest docker image.
0 commit comments