-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile_server
89 lines (83 loc) · 3.11 KB
/
Dockerfile_server
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# docker build -t pcago-server:1.1 -f ./Dockerfile_server .
FROM ubuntu:18.04
# Avoid interaction when installing npm
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
unzip \
r-base \
wget \
ffmpeg \
libcurl4-gnutls-dev \
libxml2-dev \
libssl-dev \
libmysqlclient-dev \
libcairo2-dev \
libgtk2.0-dev \
xvfb \
xauth \
xfonts-base \
libxt-dev \
libgconf2-4 \
git
RUN apt-get install -y npm build-essential
### from https://github.com/rocker-org/shiny/tree/3.4.3
RUN apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
xtail \
wget
# Download and install shiny server
RUN wget --no-verbose https://download3.rstudio.org/ubuntu-18.04/x86_64/VERSION -O "version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb && \
. /etc/environment
#&& \
#R -e "install.packages(c('shiny', 'rmarkdown'), repos='$MRAN')" && \
#cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/
EXPOSE 8000
RUN wget https://raw.githubusercontent.com/rocker-org/shiny/3.4.3/shiny-server.sh -O shiny-server.sh
RUN chmod +x shiny-server.sh
RUN mv -f shiny-server.sh /usr/bin/shiny-server.sh
RUN chown -R shiny /var/lib/shiny-server
###
RUN git clone https://github.com/rnajena/pcago-unified.git /home/shiny/pcago-unified
WORKDIR /home/shiny
# Download packrat file if it does not exist locally
RUN wget --quiet https://github.com/rnajena/pcago-unified/releases/download/ubuntu-18.04/packrat-Ubuntu-1804.zip -O packrat.zip
RUN unzip -o -qq packrat.zip -d /home/shiny/pcago-unified/src/packrat && rm packrat.zip
RUN mv /home/shiny/pcago-unified/src/packrat/lib/x86_64-pc-linux-gnu/3.4.3 /home/shiny/pcago-unified/src/packrat/lib/x86_64-pc-linux-gnu/3.4.4
# Directly use local copy of packrat file
#COPY packrat-Ubuntu-1804-R-3.4.4.zip ./
#RUN unzip -o -qq packrat-Ubuntu-1804-R-3.4.4.zip -d /home/shiny/pcago-unified/src/packrat && rm packrat-Ubuntu-1804-R-3.4.4.zip
RUN mkdir -p /home/shiny/pcago-unified/src/packrat/lib-R && mkdir -p /home/shiny/pcago-unified/src/packrat/lib-ext
RUN echo "source('packrat/init.R')" > .Rprofile
# Create shiny configuration
RUN cat >/etc/shiny-server/shiny-server.conf <<EOF
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Magical config settings to prevent bugs with Apache reverse proxy
disable_protocols websocket xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;
# Prevent insanely low disconnect time
http_keepalive_timeout 1800;
server {
run_as shiny;
listen 8000;
app_init_timeout 1800;
app_idle_timeout 1800;
# Define a location at the base URL
location / {
app_dir /home/shiny/pcago-unified/src;
log_dir /home/shiny/logs;
}
}
EOF
# Run server and R as user shiny, id 999
USER shiny
CMD ["/usr/bin/shiny-server.sh"]