@@ -13,12 +13,12 @@ http_proxy_port=''
13
13
https_proxy_host=' '
14
14
https_proxy_port=' '
15
15
16
- if echo " $http_proxy " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
16
+ if echo " ${ http_proxy:- } " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
17
17
http_proxy_host=$( echo " $http_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|' )
18
18
http_proxy_port=$( echo " $http_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|' )
19
19
fi
20
20
21
- if echo " $https_proxy " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
21
+ if echo " ${ https_proxy:- } " | egrep -q ' http[s]?://[^:]+:[0-9]+[/]?$' ; then
22
22
https_proxy_host=$( echo " $https_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|' )
23
23
https_proxy_port=$( echo " $https_proxy " | sed -r -e ' s|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|' )
24
24
fi
37
37
exit 1
38
38
fi
39
39
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
41
48
42
49
set -x
43
50
docker build --progress=plain --build-arg=http_proxy=${http_proxy:- } --build-arg=https_proxy=${https_proxy:- } \
44
51
--build-arg MAVEN_OPTS=" -Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port} " \
45
52
--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 " \
47
54
-t $tag -f ./docker/benchbase/Dockerfile --target $target .
0 commit comments