-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_interface_creator_docker.sh
executable file
·50 lines (39 loc) · 1.12 KB
/
run_interface_creator_docker.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
#!/bin/bash
# Use -c flag for CONSOLE MODE
console=false
while [[ $# -ge 1 ]]
do
key="$1"
case $key in
-c|console)
console=true
shift
;;
esac
shift
done
if $console; then
echo "Console mode"
run_py=generate_telemetry_json.py
else
echo "GUI mode"
run_py=interface_creator.py
fi
###############################################################################
# Read version
ver=`awk 'NR==1{ print }' deploy/version.txt`
echo "Version v$ver"
img_ver=`awk 'NR==1{ print }' deploy/docker_version.txt`
echo "Docker version v$img_ver"
container_name=vnd-interface-$img_ver-c
# Remove previous container if exists
docker container rm -f $container_name 2> /dev/null || true
# Allow all users to access X11 Server
xhost +
# Run container
docker run -dt --name $container_name -v$PWD:$PWD -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=unix$DISPLAY --net=host vnd-$img_ver-image
# Exec running script in container
docker exec -it -w $PWD/interface_creator/python $container_name python3 $run_py
# Wait for killing command
read -p "Press enter to kill container"
docker container rm -f $container_name