diff --git a/contrib/packaging/docker/centos5 b/contrib/packaging/docker/centos5 --- a/contrib/packaging/docker/centos5 +++ b/contrib/packaging/docker/centos5 @@ -1,4 +1,8 @@ FROM centos:centos5 + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN \ sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo && \ sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo && \ diff --git a/contrib/packaging/docker/centos6 b/contrib/packaging/docker/centos6 --- a/contrib/packaging/docker/centos6 +++ b/contrib/packaging/docker/centos6 @@ -1,4 +1,8 @@ FROM centos:centos6 + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN yum install -y \ gcc \ gettext \ diff --git a/contrib/packaging/docker/centos7 b/contrib/packaging/docker/centos7 --- a/contrib/packaging/docker/centos7 +++ b/contrib/packaging/docker/centos7 @@ -1,4 +1,8 @@ FROM centos:centos7 + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN yum install -y \ gcc \ gettext \ diff --git a/contrib/packaging/docker/debian.template b/contrib/packaging/docker/debian.template --- a/contrib/packaging/docker/debian.template +++ b/contrib/packaging/docker/debian.template @@ -1,4 +1,8 @@ FROM debian:__CODENAME__ + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN apt-get update && apt-get install -y \ build-essential \ debhelper \ diff --git a/contrib/packaging/docker/fedora20 b/contrib/packaging/docker/fedora20 --- a/contrib/packaging/docker/fedora20 +++ b/contrib/packaging/docker/fedora20 @@ -1,4 +1,8 @@ FROM fedora:20 + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN yum install -y \ gcc \ gettext \ diff --git a/contrib/packaging/docker/fedora21 b/contrib/packaging/docker/fedora21 --- a/contrib/packaging/docker/fedora21 +++ b/contrib/packaging/docker/fedora21 @@ -1,4 +1,8 @@ FROM fedora:21 + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN yum install -y \ gcc \ gettext \ diff --git a/contrib/packaging/docker/ubuntu.template b/contrib/packaging/docker/ubuntu.template --- a/contrib/packaging/docker/ubuntu.template +++ b/contrib/packaging/docker/ubuntu.template @@ -1,4 +1,8 @@ FROM ubuntu:__CODENAME__ + +RUN groupadd -g 1000 build && \ + useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build + RUN apt-get update && apt-get install -y \ build-essential \ debhelper \ diff --git a/contrib/packaging/dockerdeb b/contrib/packaging/dockerdeb --- a/contrib/packaging/dockerdeb +++ b/contrib/packaging/dockerdeb @@ -22,6 +22,8 @@ # container and hope it's writable. Whee. dn=$(basename $ROOTDIR) +DBUILDUSER=build + if [ $(uname) = "Darwin" ] ; then $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \ sh -c "cd /mnt/$dn && make clean && make local" diff --git a/contrib/packaging/dockerlib.sh b/contrib/packaging/dockerlib.sh --- a/contrib/packaging/dockerlib.sh +++ b/contrib/packaging/dockerlib.sh @@ -26,17 +26,5 @@ [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } CONTAINER="hg-dockerrpm-$1" - DBUILDUSER=build - ( - cat $DFILE - if [ $(uname) = "Darwin" ] ; then - # The builder is using boot2docker on OS X, so we're going to - # *guess* the uid of the user inside the VM that is actually - # running docker. This is *very likely* to fail at some point. - echo RUN useradd $DBUILDUSER -u 1000 - else - echo RUN groupadd $DBUILDUSER -g `id -g` -o - echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER -o - fi - ) | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER - + cat $DFILE | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER - } diff --git a/contrib/packaging/dockerrpm b/contrib/packaging/dockerrpm --- a/contrib/packaging/dockerrpm +++ b/contrib/packaging/dockerrpm @@ -16,6 +16,8 @@ $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* DSHARED=/mnt/shared +DBUILDUSER=build + $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean