run-docker.sh 866 B

123456789101112131415161718192021222324252627282930313233343536
  1. # Small script to run tests for a target (or all targets) inside all the
  2. # respective docker images.
  3. set -ex
  4. run() {
  5. local target=$1
  6. echo $target
  7. # This directory needs to exist before calling docker, otherwise docker will create it but it
  8. # will be owned by root
  9. mkdir -p target
  10. docker build -t $target ci/docker/$target
  11. docker run \
  12. --rm \
  13. --user $(id -u):$(id -g) \
  14. -e CARGO_HOME=/cargo \
  15. -e CARGO_TARGET_DIR=/target \
  16. -v $HOME/.cargo:/cargo \
  17. -v `pwd`/target:/target \
  18. -v `pwd`:/checkout:ro \
  19. -v `rustc --print sysroot`:/rust:ro \
  20. -w /checkout \
  21. -it $target \
  22. sh -c "HOME=/tmp PATH=\$PATH:/rust/bin ci/run.sh $target"
  23. }
  24. if [ -z "$1" ]; then
  25. for d in `ls ci/docker/`; do
  26. run $d
  27. done
  28. else
  29. run $1
  30. fi