diff options
| author | oxpa <iippolitov@gmail.com> | 2024-09-17 14:21:10 +0100 |
|---|---|---|
| committer | oxpa <iippolitov@gmail.com> | 2024-09-17 14:21:10 +0100 |
| commit | 2417826d8bebf921ee1be102ef8ce702f0683d66 (patch) | |
| tree | 76d29a1705415ed7368870826dbb2f04942ee794 /tools/unitctl/build/container.mk | |
| parent | 0e79d961bb1ea68674961da1703ffedb1ddf6e43 (diff) | |
| parent | 24ed91f40634372d99f67f0e4e3c2ac0abde81bd (diff) | |
| download | unit-2417826d8bebf921ee1be102ef8ce702f0683d66.tar.gz unit-2417826d8bebf921ee1be102ef8ce702f0683d66.tar.bz2 | |
Merge tag '1.33.0' into packaging.
Unit 1.33.0 release.
Diffstat (limited to 'tools/unitctl/build/container.mk')
| -rw-r--r-- | tools/unitctl/build/container.mk | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/unitctl/build/container.mk b/tools/unitctl/build/container.mk new file mode 100644 index 00000000..c892db2e --- /dev/null +++ b/tools/unitctl/build/container.mk @@ -0,0 +1,67 @@ + ## Builds a container image for building on Debian Linux +.PHONY: container-debian-build-image +.ONESHELL: container-debian-build-image +container-debian-build-image: +container-debian-build-image: + $Q echo "$(M) building debian linux docker build image: $(@)" + $(DOCKER) buildx build $(DOCKER_BUILD_FLAGS)\ + -t debian_builder -f Dockerfile $(CURDIR); + + ## Builds deb packages using a container image +.PHONY: container-deb-packages +container-deb-packages: container-debian-build-image + $Q $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder make deb-packages + # Reset permissions on the target directory to the current user + if command -v id > /dev/null; then \ + $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder \ + chown --recursive "$(shell id -u):$(shell id -g)" /project/target + fi + + ## Builds a rpm packages using a container image +.PHONY: container-rpm-packages +container-rpm-packages: container-debian-build-image + $Q $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder make rpm-packages + # Reset permissions on the target directory to the current user + if command -v id > /dev/null; then \ + $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder chown --recursive \ + "$(shell id -u):$(shell id -g)" /project/target + fi + +## Builds all packages using a container image +.PHONY: container-all-packages +container-all-packages: container-debian-build-image + $Q $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder make all-packages + # Reset permissions on the target directory to the current user + if command -v id > /dev/null; then \ + $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder \ + chown --recursive "$(shell id -u):$(shell id -g)" /project/target + fi + +## Run tests inside container +.PHONY: container-test +container-test: container-debian-build-image + $Q $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder make test + # Reset permissions on the target directory to the current user + if command -v id > /dev/null; then \ + $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder \ + chown --recursive "$(shell id -u):$(shell id -g)" /project/target + fi + +.PHONY: container-shell +container-shell: container-debian-build-image ## Run tests inside container + $Q $(DOCKER) run -it --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder bash + # Reset permissions on the target directory to the current user + if command -v id > /dev/null; then \ + $(DOCKER) run --rm --volume "$(CURDIR):/project" \ + --workdir /project debian_builder \ + chown --recursive "$(shell id -u):$(shell id -g)" /project/target + fi |
