-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_visualizer.sh
executable file
·31 lines (31 loc) · 1.1 KB
/
start_visualizer.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
# Check for presence of Docker/Podman engines
if command -v docker &> /dev/null
then
export container_engine=docker
elif command -v podman &> /dev/null
then
export container_engine=podman
else
echo "Error: Docker or Podman not found. Please install container engine and try again."
exit 1
fi
# Return if no inputs passed
if [ -z "$1" ]
then
echo "Error: no data directory specified."
exit 1
fi
# Set data directory to absolute path of input
export datadir=$( cd $1; pwd )
# Set mount directory to data directory if not specified
if [ -z "$2" ]
then
echo "No mount directory specified: defaulting to $datadir"
export mountdir=$datadir
else
export mountdir=$2
fi
# Start visualizer
$container_engine build . -f Containerfile -t clams-mmif-visualizer
$container_engine run -d --name clams-mmif-visualizer --rm -p 5000:5000 -e PYTHONUNBUFFERED=1 -v $datadir:$mountdir -v $datadir:/app/static/$mountdir clams-mmif-visualizer
echo "MMIF Visualizer is running in the background and can be accessed at http://localhost:5000/. To shut it down, run '$container_engine kill clams-mmif-visualizer'"