-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.sh
executable file
·37 lines (35 loc) · 1 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
#!/bin/sh
# Launch interactive mode using -i parameter
# Otherwise all parameters are forwarded to the main.py script
printf "Building docker image ... "
OUTPUT=$(docker build ./docker/ -q -t beatdetectionarduinoengine:1.0 2>&1)
if [ $? -ne 0 ] ; then
echo "\n\e[31mError while building image :\e[0m"
echo "$OUTPUT"
exit 1
else
echo "\e[32mOK\e[0m"
fi
if [ "$1" = "-i" ] ; then
docker run \
--device /dev/snd \
--device /dev/ttyS2 \
--cap-add=SYS_NICE \
-v $(pwd):/app \
-it beatdetectionarduinoengine:1.0 bash -c "cd /app; bash"
elif [ "$1" = "-d" ] ; then
shift
docker run \
--device /dev/snd \
--device /dev/ttyS2 \
--cap-add=SYS_NICE \
-v $(pwd):/app \
-i beatdetectionarduinoengine:1.0 /app/docker/start.sh $@
else
docker run \
--device /dev/snd \
--device /dev/ttyS2 \
--cap-add=SYS_NICE \
-v $(pwd):/app \
-it beatdetectionarduinoengine:1.0 /app/docker/start.sh $@
fi