@@ -13,12 +13,12 @@ http_proxy_port=''
1313https_proxy_host=' '
1414https_proxy_port=' '
1515
16- if echo " $http_proxy " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
16+ if echo " ${ http_proxy:- } " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
1717 http_proxy_host=$( echo " $http_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|' )
1818 http_proxy_port=$( echo " $http_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|' )
1919fi
2020
21- if echo " $https_proxy " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
21+ if echo " ${ https_proxy:- } " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
2222 https_proxy_host=$( echo " $https_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|' )
2323 https_proxy_port=$( echo " $https_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|' )
2424fi
3737 exit 1
3838fi
3939
40- GID=$( getent passwd $UID | cut -d: -f4)
40+ CONTAINERUSER_UID=" ${CONTAINERUSER_UID:- $UID } "
41+ if [ " $CONTAINERUSER_UID " -eq 0 ] && [ -n " ${SUDO_UID:- } " ]; then
42+ CONTAINERUSER_UID=" $SUDO_UID "
43+ fi
44+ CONTAINERUSER_GID=${CONTAINERUSER_GID:- $(getent passwd " $CONTAINERUSER_UID " | cut -d: -f4)}
45+ if [ -z " $CONTAINERUSER_GID " ]; then
46+ echo " WARNING: missing CONTAINERUSER_GID." >&2
47+ fi
4148
4249set -x
4350docker build --progress=plain --build-arg=http_proxy=${http_proxy:- } --build-arg=https_proxy=${https_proxy:- } \
4451 --build-arg MAVEN_OPTS=" -Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port} " \
4552 --build-arg BENCHBASE_PROFILES=" ${BENCHBASE_PROFILES} " \
46- --build-arg UID= $UID --build-arg GID= $GID \
53+ --build-arg CONTAINERUSER_UID= " $CONTAINERUSER_UID " --build-arg CONTAINERUSER_GID= " $CONTAINERUSER_GID " \
4754 -t $tag -f ./docker/benchbase/Dockerfile --target $target .
0 commit comments