comparison contrib/packaging/dockerdeb @ 38457:11eda1f1b6e7

packaging: consistently create build user in Dockerfiles Previously, dockerlib.sh appended some commands to create a "build" user in each Docker image. The resulting Docker images could be inconsistent depending on the execution environment and base image. With this change, we explicitly create our custom user and group as the first action in each Dockerfile. The user always has user:group 1000:1000 and all built images are consistent. We also create a home directory for the user under /build. This directory is currently ignored. As part of this, we stop setting the DBUILDUSER variable in dockerlib.sh and instead set it in the respective scripts that call it. This is in preparation for further refactoring of dockerlib.sh. Differential Revision: https://phab.mercurial-scm.org/D3758
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 12 May 2018 15:51:37 -0700
parents 917f635b5c6a
children e5916f1236f3
comparison
equal deleted inserted replaced
38456:1cac2e8c7624 38457:11eda1f1b6e7
20 # debuild only appears to be able to save built debs etc to .., so we 20 # debuild only appears to be able to save built debs etc to .., so we
21 # have to share the .. of the current directory with the docker 21 # have to share the .. of the current directory with the docker
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"
28 fi 30 fi
29 $DOCKER run -u $DBUILDUSER --rm -v $ROOTDIR/..:/mnt $CONTAINER \ 31 $DOCKER run -u $DBUILDUSER --rm -v $ROOTDIR/..:/mnt $CONTAINER \