From 538cf1ff5eeb4c15b6c790db4c15c6d7a77a3f5d Mon Sep 17 00:00:00 2001 From: Mayank Shah <mayankshah1614@gmail.com> Date: Tue, 10 Nov 2020 12:22:07 +0530 Subject: [PATCH] feat: Add ARM64 support Signed-off-by: Mayank Shah <mayankshah1614@gmail.com> --- Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6d365d76ca2..5059c5eb869 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ export GOPATH GOBIN GO111MODULE DOCKER_CLI_EXPERIMENTAL # Generate all combination of all OS, ARCH, and OSVERSIONS for iteration ALL_OS = linux windows -ALL_ARCH.linux = amd64 +ALL_ARCH.linux = amd64 arm64 ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch)) ALL_ARCH.windows = amd64 ALL_OSVERSIONS.windows := 1809 1903 1909 2004 @@ -112,7 +112,7 @@ e2e-teardown: .PHONY: smb smb: - CGO_ENABLED=0 GOOS=linux go build -a -ldflags ${LDFLAGS} -o _output/smbplugin ./pkg/smbplugin + CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags ${LDFLAGS} -o _output/smbplugin ./pkg/smbplugin .PHONY: smb-windows smb-windows: @@ -137,14 +137,21 @@ container-windows: -t $(IMAGE_TAG)-windows-$(OSVERSION)-$(ARCH) --build-arg OSVERSION=$(OSVERSION) -f ./pkg/smbplugin/Windows.Dockerfile . .PHONY: container-all -container-all: smb smb-windows +container-all: smb-windows docker buildx rm container-builder || true docker buildx create --use --name=container-builder - $(MAKE) container-linux for osversion in $(ALL_OSVERSIONS.windows); do \ OSVERSION=$${osversion} $(MAKE) container-windows; \ done + # enable qemu for arm64 build + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + for arch in $(ALL_ARCH.linux); do \ + ARCH=$${arch} $(MAKE) smb; \ + ARCH=$${arch} $(MAKE) container-linux; \ + done + + .PHONY: push-manifest push-manifest: docker manifest create --amend $(IMAGE_TAG) $(foreach osarch, $(ALL_OS_ARCH), $(IMAGE_TAG)-${osarch})