forked from Netflix/vmaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-bash
executable file
·40 lines (31 loc) · 1.15 KB
/
docker-bash
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
#!/bin/bash
# Convenience script to build/start a docker image for development
[[ -f /.dockerenv ]] && echo "Already in docker" && exit 1
function abort {
echo $@
exit 1
}
command -v docker > /dev/null || abort "docker is not installed, please install it first"
if [[ "$1" == "clean" ]]; then
# Remove local docker image, useful for "starting fresh" sometimes
if [[ -n `docker ps | grep vmaf-dev` ]]; then
abort "vmaf-dev container is running, can't clean, shut it down first"
fi
docker ps -a | grep vmaf-dev | cut -f1 -d" " | xargs -I {} docker rm {}
if [[ -n `docker images | grep vmaf-dev` ]]; then
docker image rm vmaf-dev
fi
exit 0
fi
BASE_DIR=`cd $(dirname $0); pwd`
if [[ -z `docker images | grep vmaf-dev` ]]; then
# Build image if it's not already there
docker build -t vmaf-dev -f Dockerfile.dev .
fi
if [[ "$1" == "empty" ]]; then
# Start an empty container, with no dir mounted, this can be used to get fresh source from github and compile
docker run -it vmaf-dev
exit 0
fi
# Map $BASE_DIR as /vmaf, and start bash session into container in /vmaf
docker run -it -v$BASE_DIR:/vmaf vmaf-dev