summaryrefslogtreecommitdiffhomepage
path: root/pkg/docker/Makefile
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2020-03-13 17:35:47 +0300
committerKonstantin Pavlov <thresh@nginx.com>2020-03-13 17:35:47 +0300
commit7181a661c5db59a40ba6b3ad0a3d8a571ad10877 (patch)
tree283ae28954c23b764ae66d08b090965c9ced8aa2 /pkg/docker/Makefile
parentbaf92303987582d226fb90175f51c4cf8457cb96 (diff)
downloadunit-7181a661c5db59a40ba6b3ad0a3d8a571ad10877.tar.gz
unit-7181a661c5db59a40ba6b3ad0a3d8a571ad10877.tar.bz2
Added a target to export docker images as tarballs
Diffstat (limited to 'pkg/docker/Makefile')
-rw-r--r--pkg/docker/Makefile27
1 files changed, 22 insertions, 5 deletions
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
index d80b8763..4b7b3807 100644
--- a/pkg/docker/Makefile
+++ b/pkg/docker/Makefile
@@ -1,6 +1,7 @@
#!/usr/bin/make
include ../../version
+include ../shasum.mak
DEFAULT_RELEASE := 1
@@ -29,12 +30,16 @@ MODULE_full="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION} unit-python2.7=$${U
MODULE_minimal="unit=$${UNIT_VERSION}"
+EXPORT_DIR := $(VERSION)
+
default:
- @echo "valid targets: all build dockerfiles push clean"
+ @echo "valid targets: all build dockerfiles push tag export clean"
dockerfiles: $(addprefix Dockerfile., $(MODULES))
-build: dockerfiles $(addprefix build-,$(MODULES))
-push: build $(addprefix push-,$(MODULES)) latest
+build: $(addprefix build-,$(MODULES))
+tag: $(addprefix tag-,$(MODULES))
+push: $(addprefix push-,$(MODULES)) latest
+export: $(addsuffix .tar.gz,$(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODULES))) $(addsuffix .tar.gz.sha512, $(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODULES)))
Dockerfile.%: ../../version
@echo "===> Building $@"
@@ -46,17 +51,29 @@ Dockerfile.%: ../../version
build-%: Dockerfile.%
docker build -t unit:$(VERSION)-$* -f Dockerfile.$* .
-push-%:
+tag-%: build-%
docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$*
+
+push-%: tag-%
docker push nginx/unit:$(VERSION)-$*
latest:
docker tag nginx/unit:$(VERSION)-full nginx/unit:latest
docker push nginx/unit:latest
+$(EXPORT_DIR):
+ mkdir -p $@
+
+$(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz: $(EXPORT_DIR) tag-%
+ docker save nginx/unit:$(VERSION)-$* | gzip > $@
+
+$(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz.sha512: $(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz
+ $(SHA512SUM) $< > $@
+
all: $(addprefix Dockerfile., $(MODULES))
clean:
rm -f $(addprefix Dockerfile., $(MODULES))
+ rm -rf $(EXPORT_DIR)
-.PHONY: default all build dockerfiles latest push clean
+.PHONY: default all build dockerfiles latest push tag export clean