-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
executable file
·59 lines (51 loc) · 1.02 KB
/
launch.sh
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
#!/bin/bash
export IMAGE=pnietoiglesias/xensb
export NAME=xensb
build(){
echo "Build $IMAGE"
docker build -t ${IMAGE} .
}
debug(){
echo "Debug ${IMAGE}"
[ -z "$SSH_AUTH_SOCK" ] && eval "$(ssh-agent -s)"
ssh-add ~/.ssh/pnieto_github
docker run -t -i -v $(readlink -f $SSH_AUTH_SOCK):/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent -p 5000:5000 ${IMAGE} /bin/bash
}
run(){
echo "Run ${IMAGE}"
docker kill ${NAME}
docker rm ${NAME}
docker run -t -i --name ${NAME} -p 5000:5000 ${IMAGE}
}
usage(){
echo "Usage: $0"
echo " -b: build image"
echo " -d: debug image with bash"
echo " -r: run"
exit 1;
}
while getopts ":bhdr" opt; do
case $opt in
b)
build
exit 1
;;
r)
run
exit 1
;;
d)
debug
exit 1
;;
h)
usage
exit 1
;;
\?)
usage
exit 1
;;
esac
done
usage