Explorar el Código

build: add native arch building support

Saúl Ibarra Corretgé hace 3 años
padre
commit
741ec4a
Se han modificado 1 ficheros con 24 adiciones y 2 borrados
  1. 24 2
      Makefile

+ 24 - 2
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