From 62142482dc25691dc402472dde5b52946ec16fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Fri, 15 Jun 2018 09:22:46 +0200 Subject: [PATCH] Updated makefiles from senpy-plugins-community --- .makefiles/docker.mk | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.makefiles/docker.mk b/.makefiles/docker.mk index f74d93f..9c1a8cd 100644 --- a/.makefiles/docker.mk +++ b/.makefiles/docker.mk @@ -1,5 +1,14 @@ -IMAGENAME?=$(NAME) +ifndef IMAGENAME + ifdef CI_REGISTRY_IMAGE + IMAGENAME=$(CI_REGISTRY_IMAGE) + else + IMAGENAME=$(NAME) + endif +endif + IMAGEWTAG?=$(IMAGENAME):$(VERSION) +DOCKER_FLAGS?=$(-ti) +DOCKER_CMD?= docker-login: ## Log in to the registry. It will only be used in the server, or when running a CI task locally (if CI_BUILD_TOKEN is set). ifeq ($(CI_BUILD_TOKEN),) @@ -19,6 +28,19 @@ else @docker logout endif +docker-run: ## Build a generic docker image + docker run $(DOCKER_FLAGS) $(IMAGEWTAG) $(DOCKER_CMD) + +docker-build: ## Build a generic docker image + docker build . -t $(IMAGEWTAG) + +docker-push: docker-login ## Push a generic docker image + docker push $(IMAGEWTAG) + +docker-latest-push: docker-login ## Push the latest image + docker tag $(IMAGEWTAG) $(IMAGENAME) + docker push $(IMAGENAME) + login:: docker-login clean:: docker-clean