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

---
 Dockerfile |  2 +-
 Makefile   | 14 ++++++++++++++
 build.sh   |  9 ---------
 3 files changed, 15 insertions(+), 10 deletions(-)
 create mode 100644 Makefile
 delete mode 100755 build.sh

diff --git a/Dockerfile b/Dockerfile
index 2405106..e3ac604 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,4 +33,4 @@ VOLUME /var/www/html
 EXPOSE 8080
 EXPOSE 8081
 
-CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
\ No newline at end of file
+CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1949a53
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+IMAGE := k8r.eu/justjanne/$(shell basename $(shell git remote get-url origin) .git)
+TAGS := $(shell git describe --always --tags HEAD)
+
+.PHONY: build
+build:
+	docker build --pull -t $(IMAGE):$(TAGS) .
+	docker tag $(IMAGE):$(TAGS) $(IMAGE):latest
+	@echo Successfully tagged $(IMAGE):$(TAGS) as latest
+
+.PHONY: push
+push: build
+	docker push $(IMAGE):$(TAGS)
+	docker push $(IMAGE):latest
+	@echo Successfully pushed $(IMAGE):$(TAGS) as latest
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 63ab251..0000000
--- a/build.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-IMAGE=k8r.eu/justjanne/php
-TAGS=$(git describe --always --tags HEAD)
-
-docker build -t $IMAGE:$TAGS .
-docker tag $IMAGE:$TAGS $IMAGE:latest
-echo Successfully tagged $IMAGE:latest
-docker push $IMAGE:$TAGS
-docker push $IMAGE:latest
\ No newline at end of file
-- 
GitLab