From f771327f0cd4bf04642b7b7171be17b242be798b Mon Sep 17 00:00:00 2001 From: Mangirdas Date: Thu, 28 Oct 2021 13:51:09 +0300 Subject: [PATCH] Add multiarch image make target Updates #3112 Signed-off-by: Mangirdas --- Dockerfile | 3 ++- Makefile | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 446089c98..6a112df54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,8 +48,9 @@ ARG VERSION_SHORT="" ENV VERSION_SHORT=$VERSION_SHORT ARG VERSION_GIT_HASH="" ENV VERSION_GIT_HASH=$VERSION_GIT_HASH +ARG TARGETARCH -RUN go install -tags=xversion -ldflags="\ +RUN GOARCH=$TARGETARCH go install -tags=xversion -ldflags="\ -X tailscale.com/version.Long=$VERSION_LONG \ -X tailscale.com/version.Short=$VERSION_SHORT \ -X tailscale.com/version.GitCommit=$VERSION_GIT_HASH" \ diff --git a/Makefile b/Makefile index 2b8ce5417..c8262ee61 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +IMAGE_REPO ?= tailscale/tailscale + usage: echo "See Makefile" @@ -21,6 +23,10 @@ build386: buildlinuxarm: GOOS=linux GOARCH=arm go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled + +buildmultiarchimage: + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ${IMAGE_REPO}:latest --push -f Dockerfile . + check: staticcheck vet depaware buildwindows build386 buildlinuxarm staticcheck: