##// END OF EJS Templates
packaging: consistently create build user in Dockerfiles...
Gregory Szorc -
r38475:11eda1f1 default
parent child Browse files
Show More
@@ -1,4 +1,8 b''
1 FROM centos:centos5
1 FROM centos:centos5
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN \
6 RUN \
3 sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo && \
7 sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo && \
4 sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo && \
8 sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo && \
@@ -1,4 +1,8 b''
1 FROM centos:centos6
1 FROM centos:centos6
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN yum install -y \
6 RUN yum install -y \
3 gcc \
7 gcc \
4 gettext \
8 gettext \
@@ -1,4 +1,8 b''
1 FROM centos:centos7
1 FROM centos:centos7
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN yum install -y \
6 RUN yum install -y \
3 gcc \
7 gcc \
4 gettext \
8 gettext \
@@ -1,4 +1,8 b''
1 FROM debian:__CODENAME__
1 FROM debian:__CODENAME__
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN apt-get update && apt-get install -y \
6 RUN apt-get update && apt-get install -y \
3 build-essential \
7 build-essential \
4 debhelper \
8 debhelper \
@@ -1,4 +1,8 b''
1 FROM fedora:20
1 FROM fedora:20
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN yum install -y \
6 RUN yum install -y \
3 gcc \
7 gcc \
4 gettext \
8 gettext \
@@ -1,4 +1,8 b''
1 FROM fedora:21
1 FROM fedora:21
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN yum install -y \
6 RUN yum install -y \
3 gcc \
7 gcc \
4 gettext \
8 gettext \
@@ -1,4 +1,8 b''
1 FROM ubuntu:__CODENAME__
1 FROM ubuntu:__CODENAME__
2
3 RUN groupadd -g 1000 build && \
4 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
5
2 RUN apt-get update && apt-get install -y \
6 RUN apt-get update && apt-get install -y \
3 build-essential \
7 build-essential \
4 debhelper \
8 debhelper \
@@ -22,6 +22,8 b' initcontainer $PLATFORM'
22 # container and hope it's writable. Whee.
22 # container and hope it's writable. Whee.
23 dn=$(basename $ROOTDIR)
23 dn=$(basename $ROOTDIR)
24
24
25 DBUILDUSER=build
26
25 if [ $(uname) = "Darwin" ] ; then
27 if [ $(uname) = "Darwin" ] ; then
26 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
28 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
27 sh -c "cd /mnt/$dn && make clean && make local"
29 sh -c "cd /mnt/$dn && make clean && make local"
@@ -26,17 +26,5 b' function initcontainer() {'
26 [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
26 [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
27
27
28 CONTAINER="hg-dockerrpm-$1"
28 CONTAINER="hg-dockerrpm-$1"
29 DBUILDUSER=build
29 cat $DFILE | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER -
30 (
31 cat $DFILE
32 if [ $(uname) = "Darwin" ] ; then
33 # The builder is using boot2docker on OS X, so we're going to
34 # *guess* the uid of the user inside the VM that is actually
35 # running docker. This is *very likely* to fail at some point.
36 echo RUN useradd $DBUILDUSER -u 1000
37 else
38 echo RUN groupadd $DBUILDUSER -g `id -g` -o
39 echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER -o
40 fi
41 ) | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER -
42 }
30 }
@@ -16,6 +16,8 b' RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM'
16 $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
16 $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
17
17
18 DSHARED=/mnt/shared
18 DSHARED=/mnt/shared
19 DBUILDUSER=build
20
19 $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
21 $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
20 rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean
22 rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean
21
23
General Comments 0
You need to be logged in to leave comments. Login now