From 77c736020c5ce89f33a869ee7f9f1ea2085d1013 Mon Sep 17 00:00:00 2001
From: "Hartung, Michael" <michael.hartung@uni-hamburg.de>
Date: Mon, 26 Sep 2022 15:03:09 +0200
Subject: [PATCH] Do not push to production from development ;)

---
 deploy_prod.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/deploy_prod.sh b/deploy_prod.sh
index 45e4fab..145fd9f 100755
--- a/deploy_prod.sh
+++ b/deploy_prod.sh
@@ -1,2 +1,9 @@
-docker build -t gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod -f ./Dockerfile .
-docker push gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
\ No newline at end of file
+#!/bin/bash
+
+branch=$(git rev-parse --abbrev-ref HEAD)
+if [ "$branch" == "production" ]; then
+	docker build -t gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod -f ./Dockerfile .
+	docker push gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
+else 
+	echo "DENIED: Your are not in the production branch. Do not push to production from the ${branch} branch."
+fi
-- 
GitLab