2014-04-25 18:02:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if test $# -eq 0; then
|
|
|
|
echo "Usage: $0 [--container <container_name>] -- <command_to_run_in_docker>"
|
|
|
|
echo "Ex: $0 make test"
|
|
|
|
echo "Ex: $0 ./test/ci.sh"
|
|
|
|
echo "Ex: $0 --container joshuawarner32/avian-build-windows -- make platform=windows"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-12-05 20:25:10 +00:00
|
|
|
THE_USER="-u $(id -u "${USER}")"
|
|
|
|
|
2014-06-11 15:54:48 +00:00
|
|
|
while test $# -gt 1 ; do
|
2014-04-25 18:02:12 +00:00
|
|
|
key="$1"
|
|
|
|
case $key in
|
|
|
|
-c|--container)
|
|
|
|
shift
|
|
|
|
CONTAINER="$1"
|
|
|
|
shift
|
|
|
|
;;
|
2014-12-05 20:25:10 +00:00
|
|
|
-r|--root)
|
|
|
|
shift
|
|
|
|
THE_USER=
|
|
|
|
;;
|
2014-04-25 18:02:12 +00:00
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z $CONTAINER; then
|
|
|
|
CONTAINER=joshuawarner32/avian-build
|
|
|
|
fi
|
|
|
|
|
|
|
|
DIR=$(cd $(dirname "$0") && cd .. && pwd)
|
|
|
|
|
2015-12-22 07:36:50 +00:00
|
|
|
docker run --rm -i -t -v "${DIR}":/var/src/avian ${THE_USER} "${CONTAINER}" "${@}"
|