From 741ec4acdbea1f7ffb1aab29ee5b18540df7853b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 20 May 2022 12:04:48 +0200 Subject: [PATCH] build: add native arch building support --- Makefile | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a633481..7edd9da 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,24 @@ FORCE_REBUILD ?= 0 JITSI_RELEASE ?= stable JITSI_BUILD ?= latest JITSI_REPO ?= jitsi -JITSI_SERVICES ?= base base-java web prosody jicofo jvb jigasi jibri +NATIVE_ARCH ?= $(shell uname -m) + +ifeq ($(NATIVE_ARCH),x86_64) + TARGETPLATFORM := linux/amd64 + JITSI_SERVICES := base base-java web prosody jicofo jvb jigasi jibri +else ifeq ($(NATIVE_ARCH),aarch64) + TARGETPLATFORM := linux/arm64 + JITSI_SERVICES := base base-java web prosody jicofo jvb +else + TARGETPLATFORM := unsupported + JITSI_SERVICES := dummy +endif + +BUILD_ARGS := \ + --build-arg JITSI_REPO=$(JITSI_REPO) \ + --build-arg JITSI_RELEASE=$(JITSI_RELEASE) \ + --build-arg TARGETPLATFORM=$(TARGETPLATFORM) -BUILD_ARGS := --build-arg JITSI_REPO=$(JITSI_REPO) --build-arg JITSI_RELEASE=$(JITSI_RELEASE) ifeq ($(FORCE_REBUILD), 1) BUILD_ARGS := $(BUILD_ARGS) --no-cache endif @@ -14,8 +29,15 @@ all: build-all release: tag-all push-all +ifeq ($(TARGETPLATFORM), unsupported) build: + @echo "Unsupported native architecture" + @exit 1 +else +build: + @echo "Building for $(TARGETPLATFORM)" docker build $(BUILD_ARGS) --progress plain --tag $(JITSI_REPO)/$(JITSI_SERVICE) $(JITSI_SERVICE)/ +endif $(addprefix build_,$(JITSI_SERVICES)): $(MAKE) --no-print-directory JITSI_SERVICE=$(patsubst build_%,%,$@) build