-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrun_rstudio.sh
executable file
·46 lines (35 loc) · 1.03 KB
/
run_rstudio.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
SHARED_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
R_PROJECT_FILE=$SHARED_DIR/'oasisui_dev.Rproj'
R_CONTAINER_NAME='rstudio_oasisui'
# if no project file create a new blank file with default configs
if [ ! -f "$R_PROJECT_FILE" ]; then
cat >> $R_PROJECT_FILE <<EOL
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackagePath: BFE_RShiny/oasisui
PackageInstallArgs: --no-multiarch --with-keep.source
EOL
fi
docker stop $R_CONTAINER_NAME && docker rm $R_CONTAINER_NAME
docker build -f docker/Dockerfile.oasisui_development -t oasisui_dev .
docker run -d \
-e DISABLE_AUTH=true \
-e USERID=$UID \
-v $SHARED_DIR:/home/rstudio/oasisui \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
--network="host" \
--name $R_CONTAINER_NAME \
oasisui_dev:latest
echo "connect using: http://localhost:8787/"