Skip to content

Commit

Permalink
Add multiarch building support for arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Lu <bin.lu@arm.com>
  • Loading branch information
Bin Lu committed Dec 11, 2018
1 parent eaa8cd7 commit 16bef9b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DEV_IMAGE ?= golang:1.11
SHORT_NAME ?= tiller
SHORT_NAME_RUDDER ?= rudder
TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64
LINUX_ARCH ?= amd64 386 arm arm64 ppc64le s390x
DIST_DIRS = find * -type d -exec

# go option
Expand Down Expand Up @@ -69,6 +70,20 @@ docker-build: check-docker docker-binary
docker build --rm -t ${IMAGE} rootfs
docker tag ${IMAGE} ${MUTABLE_IMAGE}

# Building multi-arch docker images
.PHONY: docker-build-all
docker-build-all: BINDIR = ./rootfs
docker-build-all: check-docker build-cross
docker-build-all:
docker run --rm --privileged multiarch/qemu-user-static:register --reset
for arch in $(LINUX_ARCH); do \
cp $(BINDIR)/Dockerfile ./_dist/linux-$$arch; \
docker build --platform=linux/$$arch -t ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}-$$arch:${DOCKER_VERSION} \
./_dist/linux-$$arch; \
docker tag ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}-$$arch:${DOCKER_VERSION} \
${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}-$$arch:${MUTABLE_VERSION}; \
done

.PHONY: docker-binary-rudder
docker-binary-rudder: BINDIR = ./rootfs
docker-binary-rudder: GOFLAGS += -a -installsuffix cgo
Expand Down

0 comments on commit 16bef9b

Please sign in to comment.