2
0

Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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
  12. TARGETPLATFORM := unsupported
  13. endif
  14. BUILD_ARGS := \
  15. --build-arg JITSI_REPO=$(JITSI_REPO) \
  16. --build-arg JITSI_RELEASE=$(JITSI_RELEASE)
  17. ifeq ($(FORCE_REBUILD), 1)
  18. BUILD_ARGS := $(BUILD_ARGS) --no-cache
  19. endif
  20. all: build-all
  21. release:
  22. @$(foreach SERVICE, $(JITSI_SERVICES), $(MAKE) --no-print-directory JITSI_SERVICE=$(SERVICE) buildx;)
  23. buildx:
  24. docker buildx build \
  25. --platform linux/amd64,linux/arm64 \
  26. --progress=plain \
  27. $(BUILD_ARGS) --build-arg BASE_TAG=$(JITSI_BUILD) \
  28. --pull --push \
  29. --tag $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD) \
  30. --tag $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_RELEASE) \
  31. $(JITSI_SERVICE)
  32. $(addprefix buildx_,$(JITSI_SERVICES)):
  33. $(MAKE) --no-print-directory JITSI_SERVICE=$(patsubst buildx_%,%,$@) buildx
  34. ifeq ($(TARGETPLATFORM), unsupported)
  35. build:
  36. @echo "Unsupported native architecture"
  37. @exit 1
  38. else
  39. build:
  40. @echo "Building for $(TARGETPLATFORM)"
  41. docker build \
  42. $(BUILD_ARGS) --build-arg TARGETPLATFORM=$(TARGETPLATFORM) \
  43. --progress plain \
  44. --tag $(JITSI_REPO)/$(JITSI_SERVICE) \
  45. $(JITSI_SERVICE)
  46. endif
  47. $(addprefix build_,$(JITSI_SERVICES)):
  48. $(MAKE) --no-print-directory JITSI_SERVICE=$(patsubst build_%,%,$@) build
  49. tag:
  50. docker tag $(JITSI_REPO)/$(JITSI_SERVICE) $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD)
  51. push:
  52. docker push $(JITSI_REPO)/$(JITSI_SERVICE):$(JITSI_BUILD)
  53. %-all:
  54. @$(foreach SERVICE, $(JITSI_SERVICES), $(MAKE) --no-print-directory JITSI_SERVICE=$(SERVICE) $(subst -all,;,$@))
  55. clean:
  56. docker-compose stop
  57. docker-compose rm
  58. docker network prune
  59. prepare:
  60. docker pull debian:bullseye-slim
  61. FORCE_REBUILD=1 $(MAKE)
  62. .PHONY: all build tag push clean prepare release $(addprefix build_,$(JITSI_SERVICES))