diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 82eacba..d80e758 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -4,16 +4,18 @@ set -ex run() { - local gid=$(id -g) \ - group=$(id -g -n) \ - target=$1 \ - uid=$(id -u) \ - user=$(id -u -n) + local target=$1 echo $target + + # This directory needs to exist before calling docker, otherwise docker will create it but it + # will be owned by root + mkdir -p target + docker build -t $target ci/docker/$target docker run \ --rm \ + --user $(id -u):$(id -g) \ -e CARGO_HOME=/cargo \ -e CARGO_TARGET_DIR=/target \ -v $HOME/.cargo:/cargo \ @@ -22,12 +24,7 @@ run() { -v `rustc --print sysroot`:/rust:ro \ -w /checkout \ -it $target \ - sh -c " -groupadd -g $gid $group -useradd -m -g $gid -u $uid $user -chown $user /cargo /target -su -c 'PATH=\$PATH:/rust/bin ci/run.sh $target' $user -" + sh -c "PATH=\$PATH:/rust/bin ci/run.sh $target" } if [ -z "$1" ]; then