From 4b20efdbc62a18963b1b565ad6f3da852b9f662c 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 ;)

Former-commit-id: 219e8059a3134c7880aca1b15f99a337802dad5c [formerly 5db4b8502ff0c3179df322d3493575eed4b92c3b]
Former-commit-id: 8071303e2dbeb643b7dfa4d7d548096d5a9d90c2
---
 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