Skip to content

Commit

Permalink
feat: support arm64
Browse files Browse the repository at this point in the history
fix build

add qemu workaround
  • Loading branch information
andyzhangx committed Dec 28, 2021
1 parent 30fddf2 commit 717eb6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ GOBIN ?= $(GOPATH)/bin
DOCKER_CLI_EXPERIMENTAL = enabled
export GOPATH GOBIN GO111MODULE DOCKER_CLI_EXPERIMENTAL

# The current context of image building
# The architecture of the image
ARCH ?= amd64
# Output type of docker buildx build
OUTPUT_TYPE ?= registry

ALL_ARCH.linux = amd64 #arm64
ALL_ARCH.linux = amd64 arm64
ALL_OS_ARCH = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))

all: blob blobfuse-proxy
Expand Down Expand Up @@ -93,7 +96,7 @@ e2e-teardown:

.PHONY: blob
blob: blobfuse-proxy
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/blobplugin ./pkg/blobplugin
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/${ARCH}/blobplugin ./pkg/blobplugin

.PHONY: blob-windows
blob-windows:
Expand Down Expand Up @@ -121,7 +124,9 @@ ifeq ($(CLOUD), AzureStackCloud)
docker run --privileged --name buildx_buildkit_container-builder0 -d --mount type=bind,src=/etc/ssl/certs,dst=/etc/ssl/certs moby/buildkit:latest || true
endif
# enable qemu for arm64 build
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# https://github.com/docker/buildx/issues/464#issuecomment-741507760
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64
docker run --rm --privileged tonistiigi/binfmt --install all
for arch in $(ALL_ARCH.linux); do \
ARCH=$${arch} $(MAKE) blob; \
ARCH=$${arch} $(MAKE) container-linux; \
Expand Down
8 changes: 6 additions & 2 deletions pkg/blobplugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.

FROM k8s.gcr.io/build-image/debian-base:bullseye-v1.0.0
COPY ./_output/blobplugin /blobplugin

ARG ARCH=amd64
COPY ./_output/${ARCH}/blobplugin /blobplugin

RUN apt update && apt-mark unhold libcap2
RUN clean-install ca-certificates libfuse-dev libcurl4-gnutls-dev libgnutls28-dev uuid-dev libgcrypt20-dev util-linux mount udev wget e2fsprogs nfs-common netbase
# install updated packages to fix CVE issues
Expand All @@ -23,7 +26,8 @@ COPY ./_output/blobfuse-proxy.deb /blobfuse-proxy/
# for compatibility, remove this after v1.6.0 release (todo)
COPY deploy/blobfuse-proxy/v0.1.0/blobfuse-proxy-v0.1.0.deb /blobfuse-proxy/
RUN wget -O /blobfuse-proxy/packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
RUN dpkg -i /blobfuse-proxy/packages-microsoft-prod.deb && apt update && apt install blobfuse fuse -y
ARG ARCH=amd64
RUN if [ "$ARCH" = "amd64" ] ; then dpkg -i /blobfuse-proxy/packages-microsoft-prod.deb && apt update && apt install blobfuse fuse -y; fi
RUN apt remove wget -y
LABEL maintainers="andyzhangx"
LABEL description="Azure Blob Storage CSI driver"
Expand Down

0 comments on commit 717eb6e

Please sign in to comment.