From 9af0f4aadbb7bdf05bb9fc1277f40c0a47e6182a Mon Sep 17 00:00:00 2001 From: augustin64 Date: Wed, 3 Apr 2024 15:42:14 +0200 Subject: [PATCH] build.sh: check permissions --- build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index f6917f3..b5b27f3 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,12 @@ -docker build --network host -t msrewards . -docker run -d --restart unless-stopped -p 1234:1234 -p 2345:2345 -ti --shm-size=2gb --name MsRewards msrewards +#!/bin/bash + +docker-do () { # Check if sudo needs to be used + if id -nG "$(whoami)" | grep -qw "docker"; then + docker $@ + else + sudo docker $@ + fi +} + +docker-do build --network host -t msrewards . +docker-do run -d --restart unless-stopped -p 1234:1234 -p 2345:2345 -ti --shm-size=2gb --name MsRewards msrewards