Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. FORCE_REBUILD ?= 0
  2. JITSI_RELEASE ?= stable
  3. JITSI_BUILD ?= unstable
  4. JITSI_REPO ?= jitsi
  5. NATIVE_ARCH ?= $(shell uname -m)
  6. JITSI_SERVICES := base base-java web prosody jicofo jvb jigasi jibri
  7. ifeq ($(NATIVE_ARCH),x86_64)
  8. TARGETPLATFORM := linux/amd64
  9. else ifeq ($(NATIVE_ARCH),aarch64)
  10. TARGETPLATFORM := linux/arm64
  11. else ifeq ($(NATIVE_ARCH),arm64)
  12. TARGETPLATFORM := linux/arm64
  13. else
  14. TARGETPLATFORM := unsupported
  15. endif
  16. BUILD_ARGS := \
  17. --build-arg JITSI_REPO=$(JITSI_REPO) \
  18. --build-arg JITSI_RELEASE=$(JITSI_RELEASE)
  19. ifeq ($(FORCE_REBUILD), 1)
  20. BUILD_ARGS := $(BUILD_ARGS) --no-cache
  21. endif
  22. all: build-all
  23. release:
  24. @$(foreach SERVICE, $(JITSI_SERVICES), $(MAKE) --no-print-directory JITSI_SERVICE=$(SERVICE) buildx;)
  25. buildx:
  26. docker buildx build \
  27. --platform linux/amd64,linux/arm64 \
  28. --progress=plain \
  29. $(BUILD_ARGS) --build-arg BASE_TAG=$(JITSI_BUILD) \
  30. --pull --push \
  31. --tag $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD) \
  32. --tag $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_RELEASE) \
  33. $(JITSI_SERVICE)
  34. $(addprefix buildx_,$(JITSI_SERVICES)):
  35. $(MAKE) --no-print-directory JITSI_SERVICE=$(patsubst buildx_%,%,$@) buildx
  36. ifeq ($(TARGETPLATFORM), unsupported)
  37. build:
  38. @echo "Unsupported native architecture"
  39. @exit 1
  40. else
  41. build:
  42. @echo "Building for $(TARGETPLATFORM)"
  43. docker build \
  44. $(BUILD_ARGS) --build-arg TARGETPLATFORM=$(TARGETPLATFORM) \
  45. --progress plain \
  46. --tag $(JITSI_REPO)/$(JITSI_SERVICE) \
  47. $(JITSI_SERVICE)
  48. endif
  49. $(addprefix build_,$(JITSI_SERVICES)):
  50. $(MAKE) --no-print-directory JITSI_SERVICE=$(patsubst build_%,%,$@) build
  51. tag:
  52. docker tag $(JITSI_REPO)/$(JITSI_SERVICE) $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD)
  53. push:
  54. docker push $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD)
  55. %-all:
  56. @$(foreach SERVICE, $(JITSI_SERVICES), $(MAKE) --no-print-directory JITSI_SERVICE=$(SERVICE) $(subst -all,;,$@))
  57. clean:
  58. docker-compose stop
  59. docker-compose rm
  60. docker network prune
  61. prepare:
  62. FORCE_REBUILD=1 $(MAKE)
  63. .PHONY: all build tag push clean prepare release $(addprefix build_,$(JITSI_SERVICES))