From 03a96d3765155f33c0e0b21ad5e08eb7395b91c5 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Mon, 21 Oct 2019 15:18:04 +0300 Subject: [PATCH] Add target for deploy docker images to s3 --- Makefile | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 502da5f..72c2faa 100644 --- a/Makefile +++ b/Makefile @@ -12,22 +12,26 @@ REPO_URL := "deb [trusted=yes] http://repo-doc-onlyoffice-com.s3.amazonaws.com/u UPDATE_LATEST := false ifneq (,$(findstring develop,$(GIT_BRANCH))) -DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) +DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAGS += latest else ifneq (,$(findstring release,$(GIT_BRANCH))) -DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) +DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION)) else ifneq (,$(findstring hotfix,$(GIT_BRANCH))) -DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) +DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION)) else -DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) +DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) endif +DOCKER_TAGS += $(DOCKER_TAG) + DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME) COLON := __colon__ DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) -.PHONY: all clean clean-docker deploy docker +DOCKER_ARCH := $(COMPANY_NAME)-$(PRODUCT_NAME)_$(PACKAGE_VERSION).tar.gz + +.PHONY: all clean clean-docker deploy docker publish $(DOCKER_TARGETS): $(DEB_REPO_DATA) @@ -40,13 +44,23 @@ $(DOCKER_TARGETS): $(DEB_REPO_DATA) mkdir -p $$(dirname $@) &&\ echo "Done" > $@ +$(DOCKER_ARCH): $(DOCKER_TARGETS) + docker save $(DOCKER_REPO):$(DOCKER_TAG) | \ + gzip > $@ + all: $(DOCKER_TARGETS) clean: - rm -rfv $(DOCKER_TARGETS) + rm -rfv $(DOCKER_TARGETS) $(DOCKER_ARCH) clean-docker: docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0 deploy: $(DOCKER_TARGETS) $(foreach TARGET,$(DOCKER_TARGETS),docker push $(subst $(COLON),:,$(TARGET));) + +publish: $(DOCKER_ARCH) + aws s3 cp \ + $(DOCKER_ARCH) \ + s3://repo-doc-onlyoffice-com.s3.amazonaws.com/docker/amd64/ \ + --acl public-read