p≡p engine
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.

81 lines
3.5 KiB

  1. include ../../DEPENDENCIES
  2. export
  3. PEP_MACHINE_DIR= $(PKG_INSTALL_PATH)/share/pEp
  4. YML2_VERSION=${yml2}
  5. SEQUOIA_VERSION=$(shell echo ${sequoia} | sed 's/\//-/')
  6. CURRENT_DISTRO=$(shell basename $(shell pwd))
  7. IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-engine
  8. DOCKERFILE=pEpEngine.$(CURRENT_DISTRO).Dockerfile
  9. PKG_BUILD_IMAGE=${DOCKER_REGISTRY_HOST}/fpm-$(CURRENT_DISTRO)
  10. PKG_INSTALL_PATH=/opt/pEp
  11. PKG_NAME=pEpEngine
  12. PKG_DESCRIPTION="p≡p Engine Binary RPM Package"
  13. PKG_DEPENDS=sequoia-openpgp
  14. PKG_INSTALL_PATH_STRING="/ /package/lib=${PKG_INSTALL_PATH} /package/include/pEp=${PKG_INSTALL_PATH}/include /package/share=${PKG_INSTALL_PATH}"
  15. IS_TAGGED=${TAGGED_BUILD}
  16. ifeq ($(IS_TAGGED), true)
  17. # $CI_COMMIT_TAG is a predefined environment variable from Gitlab
  18. PEPENGINE_VERSION=${CI_COMMIT_TAG}
  19. else
  20. PEPENGINE_VERSION=$(shell git rev-parse --short=8 HEAD)
  21. endif
  22. all: deps build
  23. deps:
  24. -docker pull --quiet $(IMAGE_NAME)-deps:latest
  25. cd ../../ && docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \
  26. --build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \
  27. --build-arg PEPENGINE_VERSION=$(PEPENGINE_VERSION) \
  28. --build-arg SEQUOIA_VERSION=$(SEQUOIA_VERSION) \
  29. --build-arg YML2_VERSION=$(YML2_VERSION) \
  30. --build-arg PEP_MACHINE_DIR=$(PEP_MACHINE_DIR) \
  31. --cache-from $(IMAGE_NAME):latest \
  32. --tag=$(IMAGE_NAME)-deps:$(SEQUOIA_VERSION)-$(YML2_VERSION) \
  33. --tag=$(IMAGE_NAME)-deps:latest \
  34. -f scripts/${CURRENT_DISTRO}/deps.$(DOCKERFILE) .
  35. docker push --quiet $(IMAGE_NAME)-deps:$(SEQUOIA_VERSION)-$(YML2_VERSION)
  36. docker push --quiet $(IMAGE_NAME)-deps:latest
  37. build:
  38. cd ../../ && /bin/sh ./scripts/common/build_pEpEngine.sh
  39. build-docker:
  40. -docker pull --quiet $(IMAGE_NAME):latest
  41. cd ../../ && docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \
  42. --build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \
  43. --build-arg PEPENGINE_VERSION=$(PEPENGINE_VERSION) \
  44. --build-arg SEQUOIA_VERSION=$(SEQUOIA_VERSION) \
  45. --build-arg YML2_VERSION=$(YML2_VERSION) \
  46. --build-arg PEP_MACHINE_DIR=$(PEP_MACHINE_DIR) \
  47. --cache-from $(IMAGE_NAME):latest \
  48. --tag=$(IMAGE_NAME):$(PEPENGINE_VERSION) \
  49. --tag=$(IMAGE_NAME):latest \
  50. -f scripts/common/build.pEpEngine.Dockerfile .
  51. docker push --quiet $(IMAGE_NAME):$(PEPENGINE_VERSION)
  52. docker push --quiet $(IMAGE_NAME):latest
  53. rpm:
  54. -docker pull --quiet $(PKG_BUILD_IMAGE)-engine:latest
  55. @docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \
  56. --build-arg PEPENGINE_VERSION=$(PEPENGINE_VERSION) \
  57. --build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \
  58. --build-arg PEP_MACHINE_DIR=$(PEP_MACHINE_DIR) \
  59. --build-arg PKG_INSTALL_PATH=$(PKG_INSTALL_PATH) \
  60. --cache-from $(PKG_BUILD_IMAGE)-engine:latest \
  61. --tag=$(PKG_BUILD_IMAGE)-engine:$(PEPENGINE_VERSION) \
  62. --tag=$(PKG_BUILD_IMAGE)-engine:latest \
  63. packages/rpm
  64. @docker push --quiet $(PKG_BUILD_IMAGE)-engine:$(PEPENGINE_VERSION)
  65. @docker push --quiet $(PKG_BUILD_IMAGE)-engine:latest
  66. @docker run -e PEPENGINE_VERSION=$(PEPENGINE_VERSION) \
  67. -e PEP_MACHINE_DIR=$(PEP_MACHINE_DIR) \
  68. -e PKG_VERSION=$(PEPENGINE_VERSION) \
  69. -e PKG_INSTALL_PATH=$(PKG_INSTALL_PATH) \
  70. -e PKG_NAME=$(PKG_NAME) \
  71. -e PKG_DESCRIPTION=$(PKG_DESCRIPTION) \
  72. -e PKG_DEPENDS=$(PKG_DEPENDS) \
  73. -e PKG_INSTALL_PATH_STRING=$(PKG_INSTALL_PATH_STRING) \
  74. --rm -v $(shell pwd)/packages/rpm/create-engine-rpm.sh:/usr/bin/create-rpm.sh:ro \
  75. -v $(shell pwd)/out:/out \
  76. -w / $(PKG_BUILD_IMAGE)-engine:latest \
  77. /usr/bin/create-rpm.sh