-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_docker.sh
More file actions
45 lines (34 loc) · 917 Bytes
/
run_docker.sh
File metadata and controls
45 lines (34 loc) · 917 Bytes
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
#!/bin/bash
if [[ "$1" == "-h" ]]
then
cat << EOF
$0 (tag) (command)
will start interactive shell for tag if command empty
or
will run with the command provided
EOF
exit 0
fi
PWD=$(pwd)
. ${PWD}/.myconfig.sh
tag=${1:-$tag}
shift
case $USER in
codespace)
WORKSPACE=/workspaces
;;
*)
WORKSPACE=$PWD
;;
esac
# pull the docker if necessary
docker pull $dockerrepo:$tag
# map the cache
if [[ -d .cache ]] ; then
export DOCKEREXTRA="$DOCKEREXTRA -v $PWD/.cache:/home/rstudio/.cache"
fi
# Dropbox stuff
if [[ ! -z $DROPBOX_SECRET_BASE ]]; then export DOCKEREXTRA="$DOCKEREXTRA -e DROPBOX_SECRET_BASE=$DROPBOX_SECRET_BASE" ; fi
if [[ ! -z $DROPBOX_SECRET_RLKEY ]]; then export DOCKEREXTRA="$DOCKEREXTRA -e DROPBOX_SECRET_RLKEY=$DROPBOX_SECRET_RLKEY" ; fi
DOCKEREXTRA="$DOCKEREXTRA --entrypoint /bin/bash"
docker run $DOCKEREXTRA -v "$WORKSPACE":/home/rstudio/${PWD##*/} --rm $dockerrepo:$tag $@