forked from hatem-darweesh/assuremappingtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-docker
executable file
·73 lines (66 loc) · 1.69 KB
/
run-docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# exit when any command fails
set -e
# Functions
function help()
{
cat << EOF >&2
Usage: ${0##*/} [options]
This run script will assist you to run assuremappingtools container
-h,--help Show this help
Optional:
-b,--branch Branch name or tag name, if not provided it uses master.
-w,--workspace Absolute path for the working directory, if not provided no workspace added
This should be used to access your files on the host machine.
EOF
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
help
exit 0 ;;
-b|--branch)
TAG="$2"
shift 2 ;;
-w|--workspace)
if [[ "${2:0:1}" = "/" ]]; then
if [[ -d $2 ]]; then
WORKSPACE="$2"
else
echo "The provided workspace is not exist: $2" >&2
exit 1
fi
else
echo "The provided workspace path should be absolute" >&2
exit 1
fi
shift 2 ;;
--)
shift; break ;;
*)
echo "Unknown option: $1" >&2
exit 1 ;;
esac
done
if [ -z "$TAG" ]
then
echo "No specific tag provided using 'master'"
TAG=master
else
echo "tag specified using '${TAG}'"
fi
if [ -z "$WORKSPACE" ]
then
echo "No specific workspace path provided. Running without workspace."
else
echo "using '${WORKSPACE}' as data workspace and added as volume under '/assuremappingtools/Maps'"
ADD_VOLUME="-v ${WORKSPACE}:/assuremappingtools/Maps"
fi
xhost + && \
docker run -it --rm \
--env="DISPLAY=$DISPLAY" \
${ADD_VOLUME} \
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
--device=/dev/dri/card0:/dev/dri/card0 \
--privileged \
zatitech/assuremappingtools:${TAG}