From 3ec239e578b8f10a883aa57320350e202da7bc48 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Wed, 11 Dec 2019 18:25:14 +0100
Subject: [PATCH] Updated build scripts

---
 Makefile | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 724ed10..e2f27ba 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,18 @@
-NAME=k8r.eu/justjanne/android-sdk
-PLATFORM=28
-BUILD_TOOLS=28.0.3
-
-.PHONY: all
-all: push
+IMAGE := k8r.eu/justjanne/$(shell basename $(shell git remote get-url origin) .git)
+PLATFORM := 28
+BUILD_TOOLS := 28.0.3
+TAGS := $(PLATFORM)-$(BUILD_TOOLS)
 
 .PHONY: build
-build: Dockerfile
-	docker build -t $(NAME):$(PLATFORM)-$(BUILD_TOOLS) --build-arg PLATFORM=$(PLATFORM) --build-arg BUILD_TOOLS=$(BUILD_TOOLS) .
-	docker tag $(NAME):$(PLATFORM)-$(BUILD_TOOLS) $(NAME):latest
+build:
+	docker build --pull -t $(IMAGE):$(TAGS) . \
+	  --build-arg PLATFORM=$(PLATFORM) \
+	  --build-arg BUILD_TOOLS=$(BUILD_TOOLS)
+	docker tag $(IMAGE):$(TAGS) $(IMAGE):latest
+	@echo Successfully tagged $(IMAGE):$(TAGS) as latest
 
 .PHONY: push
 push: build
-	docker push $(NAME):$(PLATFORM)-$(BUILD_TOOLS)
-	docker push $(NAME):latest
-
+	docker push $(IMAGE):$(TAGS)
+	docker push $(IMAGE):latest
+	@echo Successfully pushed $(IMAGE):$(TAGS) as latest
-- 
GitLab