Skip to content

Commit

Permalink
feat: Add ARM64 support
Browse files Browse the repository at this point in the history
Signed-off-by: Mayank Shah <[email protected]>
  • Loading branch information
mayankshah1607 committed Nov 10, 2020
1 parent 126f1ce commit 538cf1f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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})
Expand Down

0 comments on commit 538cf1f

Please sign in to comment.