You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

1 year ago
1 year ago
1 year ago
  1. # 需修改的參數
  2. # registry group 名稱
  3. GROUP_ID=athenaopt
  4. ## app id
  5. APP_ID=demo-athenaopt
  6. ## app 名稱
  7. APP_NAME=demo-athenaopt
  8. ## 平台版本
  9. PLATFORM_VERSION=5.2.0
  10. ## dap 平台類別,前端就是 frontend, 後端就是 backend
  11. DAP_TYPE=backend
  12. ## registry 位置
  13. DOCKER_REGISTRY_URL=registry.digiwincloud.com.cn
  14. SHELL=/bin/bash
  15. # make 指令
  16. MAKE=make
  17. # maven 指令
  18. MAVEN=mvn
  19. MAVEN_CLEAN=$(MAVEN) clean
  20. MAVEN_PACKAGE=$(MAVEN) -f pom.xml package
  21. #docker
  22. DOCKER_CMD=docker
  23. DOCKER_BUILD=$(DOCKER_CMD) build
  24. DOCKER_RM_IMAGE=$(DOCKER_CMD) rmi
  25. DOCKER_PUSH=$(DOCKER_CMD) push
  26. DOCKER_IMAGE_REGISTRY=$(DOCKER_REGISTRY_URL)/$(GROUP_ID)/
  27. DOCKER_IMAGE_NAME=$(APP_NAME)$(DAP_TYPE)-$(PLATFORM_VERSION)
  28. DOCKER_FULL_IMAGE=$(DOCKER_IMAGE_REGISTRY)$(DOCKER_IMAGE_NAME):$(VERSION).$(shell cat $(SUB_VERSION_FILE))
  29. #打包
  30. VERSION:=$(shell cat VERSION)
  31. #版本控制
  32. SUB_VERSION_FILE=./version_control/BUILD
  33. all: docker_ci
  34. clean:
  35. $(MAVEN_CLEAN) -f pom.xml
  36. package:
  37. $(MAVEN_PACKAGE) -f pom.xml
  38. docker_build:
  39. @echo "開始打包 Docker Image - $(DOCKER_FULL_IMAGE)"
  40. DOCKER_BUILDKIT=1 $(DOCKER_BUILD) -t $(DOCKER_FULL_IMAGE) .
  41. docker_push:
  42. @echo "開始 push docker image - $(DOCKER_FULL_IMAGE)"
  43. $(DOCKER_PUSH) $(DOCKER_FULL_IMAGE)
  44. docker_clean:
  45. $(DOCKER_RM_IMAGE) $(DOCKER_FULL_IMAGE)
  46. docker_ci: vc docker_build docker_push docker_clean to_git
  47. vc:
  48. @make -C version_control branch=$$branch
  49. to_git:
  50. @make -C version_control branch=$$branch commit_record
  51. @make -C version_control branch=$$branch add_tag