##// END OF EJS Templates
dockerlib: extract initcontainer() method...
Augie Fackler -
r24969:227b9b2a default
parent child Browse files
Show More
@@ -17,3 +17,19 b' function checkdocker() {'
17 $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
17 $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
18 $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
18 $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
19 }
19 }
20
21 # Construct a container and leave its name in $CONTAINER for future use.
22 function initcontainer() {
23 [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; }
24
25 DFILE="$ROOTDIR/contrib/docker/$1"
26 [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
27
28 CONTAINER="hg-dockerrpm-$1"
29 DBUILDUSER=build
30 (
31 cat $DFILE
32 echo RUN groupadd $DBUILDUSER -g `id -g`
33 echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER
34 ) | $DOCKER build --tag $CONTAINER -
35 }
@@ -3,25 +3,14 b''
3 . $(dirname $0)/dockerlib.sh
3 . $(dirname $0)/dockerlib.sh
4
4
5 BUILDDIR=$(dirname $0)
5 BUILDDIR=$(dirname $0)
6 ROOTDIR=$(cd $BUILDDIR/..; pwd)
6 export ROOTDIR=$(cd $BUILDDIR/..; pwd)
7
7
8 checkdocker
8 checkdocker
9
9
10 PLATFORM="$1"
10 PLATFORM="$1"
11 [ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; }
12 shift # extra params are passed to buildrpm
11 shift # extra params are passed to buildrpm
13
12
14 DFILE="$ROOTDIR/contrib/docker/$PLATFORM"
13 initcontainer $PLATFORM
15 [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
16
17 CONTAINER="hg-dockerrpm-$PLATFORM"
18
19 DBUILDUSER=build
20 (
21 cat $DFILE
22 echo RUN groupadd $DBUILDUSER -g `id -g`
23 echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER
24 ) | $DOCKER build --tag $CONTAINER -
25
14
26 RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
15 RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
27 contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
16 contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
General Comments 0
You need to be logged in to leave comments. Login now