From 93d1f2d01ce10cea65029b137c0527291b7ef3b4 Mon Sep 17 00:00:00 2001
From: pedro <git2021@cas.cat>
Date: Fri, 3 Nov 2023 09:59:56 +0100
Subject: [PATCH] idhub build: add detach on production env

---
 idhub_build.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/idhub_build.sh b/idhub_build.sh
index e52ced3..ba728f6 100755
--- a/idhub_build.sh
+++ b/idhub_build.sh
@@ -6,10 +6,17 @@ set -u
 set -x
 
 main() {
+        deployment="${1:-}"
+
+        # detach on production deployment
+        if [ "${deployment}" = 'prod' ]; then
+                detach='-d'
+        fi
+
         idhub_dc_f='docker-compose_idhub-temp.yml'
         docker compose -f ${idhub_dc_f} down -v \
                 && make docker_build \
-                && docker compose -f ${idhub_dc_f} up
+                && docker compose -f ${idhub_dc_f} up ${detach:-}
 }
 
 main "${@}"