From ca48db0d606d21fdc9637f001a82852de9c3e288 Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Wed, 10 Jan 2024 19:19:20 +0000 Subject: [PATCH] Makefile,build_docker.sh: allow to configure target platform. (#10806) Build dev tailscale and k8s-operator images for linux/amd64 only by default, make it possible to configure target build platform via PLATFORM var. Updates#cleanup Signed-off-by: Irbe Krumina --- Makefile | 6 ++++-- build_docker.sh | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3a5db44f4..1f9427ceb 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ SYNO_ARCH ?= "amd64" SYNO_DSM ?= "7" TAGS ?= "latest" +PLATFORM ?= "flyio" ## flyio==linux/amd64. Set to "" to build all platforms. + vet: ## Run go vet ./tool/go vet ./... @@ -88,7 +90,7 @@ publishdevimage: ## Build and publish tailscale image to location specified by $ @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1) @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1) @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1) - TAGS="${TAGS}" REPOS=${REPO} PUSH=true TARGET=client ./build_docker.sh + TAGS="${TAGS}" REPOS=${REPO} PLATFORM=${PLATFORM} PUSH=true TARGET=client ./build_docker.sh publishdevoperator: ## Build and publish k8s-operator image to location specified by ${REPO} @test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1) @@ -96,7 +98,7 @@ publishdevoperator: ## Build and publish k8s-operator image to location specifie @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1) @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1) @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1) - TAGS="${TAGS}" REPOS=${REPO} PUSH=true TARGET=operator ./build_docker.sh + TAGS="${TAGS}" REPOS=${REPO} PLATFORM=${PLATFORM} PUSH=true TARGET=operator ./build_docker.sh help: ## Show this help @echo "\nSpecify a command. The choices are:\n" diff --git a/build_docker.sh b/build_docker.sh index 98237ab6d..30e00d37f 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -32,6 +32,7 @@ PUSH="${PUSH:-false}" TARGET="${TARGET:-${DEFAULT_TARGET}}" TAGS="${TAGS:-${DEFAULT_TAGS}}" BASE="${BASE:-${DEFAULT_BASE}}" +PLATFORM="${PLATFORM:-}" # default to all platforms case "$TARGET" in client) @@ -50,6 +51,7 @@ case "$TARGET" in --tags="${TAGS}" \ --repos="${REPOS}" \ --push="${PUSH}" \ + --target="${PLATFORM}" \ /usr/local/bin/containerboot ;; operator) @@ -65,6 +67,7 @@ case "$TARGET" in --tags="${TAGS}" \ --repos="${REPOS}" \ --push="${PUSH}" \ + --target="${PLATFORM}" \ /usr/local/bin/operator ;; *)