-
Notifications
You must be signed in to change notification settings - Fork 2
/
env.sh
executable file
·32 lines (29 loc) · 1.09 KB
/
env.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
#/bin/bash
# Usage ./run.sh <arg1>
# <arg1> - build / run / empty
# Using same name for container & image here
DEFAULT_NAME=vslam_cuda10_2_optim
PROJECT_PATH=$(pwd)
if [ "$1" == "build" ]; then
echo -e "################################################################################\n"
echo -e "Building Docker Image $DEFAULT_NAME \n\n"
docker build -t $DEFAULT_NAME Docker
elif [ "$1" == "run" ]; then
echo -e "################################################################################\n"
echo -e "Building Docker Container $DEFAULT_NAME \n\n"
xhost +local:docker # Display
docker run -it \
--name=$DEFAULT_NAME \
--device=/dev/video0:/dev/video0:rw \
--gpus device=all \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /media/james/D1/D-SLAM/data/:/data \
-v $PROJECT_PATH:/vslam \
$DEFAULT_NAME:latest \
/bin/bash
else
xhost +local:docker # Display
docker start $DEFAULT_NAME
docker attach $DEFAULT_NAME
fi