-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlaunch_docker.sh
More file actions
executable file
·57 lines (52 loc) · 1.65 KB
/
launch_docker.sh
File metadata and controls
executable file
·57 lines (52 loc) · 1.65 KB
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
51
52
53
54
55
56
57
#! /bin/bash
#
# Run to launch a docker container named "simcore_latest".
# Provide the flag '-b' to force rebuilding the project image:
# >> ./run_docker.sh -b
# Provide the flag '-x' to launch/build experimental image from jmm/experimental branch
# >> ./run_docker.sh -bx
show_help() {
echo "Without additional options, $0 launches a docker container named simcore_latest to run in the background"
echo "USAGE:"
echo " $0 [-hbx]"
echo "OPTIONS:"
echo " -h show this menu"
echo " -b force rebuild of simcore Docker image"
echo " -x build/launch experimental version of simcore Docker image"
}
# Reset in case getopts has been used previously in the shell.
OPTIND=1
experimental=false
build=false
while getopts "h?bx" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
b)
build=true
;;
x)
experimental=true
;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
if $build; then
if $experimental; then
echo "Building experimental docker image"
docker build --no-cache -f docker/Dockerfile_experimental -t jeffmm/simcore:experimental docker
else
echo "Building docker image"
docker build --no-cache -t jeffmm/simcore:latest docker
fi
elif $experimental; then
echo "Launching experimental simcore docker container"
docker run --rm -itd -v "${PWD}":/mnt --name "simcore_experimental" jeffmm/simcore:experimental bash
# Otherwise, just start up the containers
else
echo "Launching simcore docker container"
docker run --rm -itd -v "${PWD}":/mnt --name "simcore_latest" jeffmm/simcore bash
fi