This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
193 lines (170 loc) · 6.29 KB
/
Dockerfile
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# -----------------------------------------
#
# start with basic debian
#
# -----------------------------------------
FROM debian:testing
ADD tools/rootfs.tar.xz /
# -----------------------------------------
#
# FROM R-BASE
#
# -----------------------------------------
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
procps \
&& rm -rf /var/lib/apt/lists/*
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
## Use Debian unstable via pinning -- new style via APT::Default-Release
RUN echo "deb http://http.debian.net/debian sid main" > /etc/apt/sources.list.d/debian-unstable.list \
&& echo 'APT::Default-Release "testing";' > /etc/apt/apt.conf.d/default
ENV R_BASE_VERSION 3.4.1
## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
&& apt-get install -t unstable -y --no-install-recommends \
littler \
r-cran-littler \
r-base=${R_BASE_VERSION}* \
r-base-dev=${R_BASE_VERSION}* \
r-recommended=${R_BASE_VERSION}* \
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
# --------------------------------------------------------
#
# Install all the pre-reqs (and optional supplied in system-libraries.txt)
#
# --------------------------------------------------------
ENV SYS_LIBS "${SYSLIBS}"
RUN apt-get update && apt-get install -y -t unstable \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-openssl-dev \
libssl-dev \
libcairo2-dev/unstable \
libxt-dev \
libnss-wrapper \
gettext $SYS_LIBS
# --------------------------------------------------------
#
# Install shiny and rmarkdown
#
# --------------------------------------------------------
RUN install2.r --error shiny rmarkdown
# --------------------------------------------------------
#
# Download and install shiny server
#
# --------------------------------------------------------
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb && \
cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/
# --------------------------------------------------------
# GitHub R packages
# --------------------------------------------------------
ENV R_GH_LIBS "${RGHLIBS}"
RUN if [ "$R_GH_LIBS" ]; \
then \
echo "Installing GitHub packages: '$R_GH_LIBS'" && \
install2.r --error remotes && \
R -e "lapply(strsplit(Sys.getenv('R_GH_LIBS'), '\\\s+')[[1]], remotes::install_github)"; \
fi
# --------------------------------------------------------
#
# Install R packages if required
#
# --------------------------------------------------------
ENV R_LIBS "${RLIBS}"
RUN if [ "$R_LIBS" ]; \
then \
echo "Installing CRAN packages: '$R_LIBS'" && \
install2.r --error $R_LIBS; \
fi
# --------------------------------------------------------
# GitHub R packages
# --------------------------------------------------------
ENV R_GH_LIBS "${RGHLIBS}"
RUN if [ "$R_GH_LIBS" ]; \
then \
echo "Installing GitHub packages: '$R_GH_LIBS'" && \
install2.r --error remotes && \
R -e "lapply(strsplit(Sys.getenv('R_GH_LIBS'), '\\\s+')[[1]], remotes::install_github)"; \
fi
# --------------------------------------------------------
#
# add custom configuration
#
# --------------------------------------------------------
COPY tools/shiny-server.conf /etc/shiny-server/
# --------------------------------------------------------
#
# Make and set permissions for log & bookmarks directories
#
# --------------------------------------------------------
RUN sudo mkdir -p /var/shinylogs/shiny-server && \
mkdir -p /var/lib/shiny-server/bookmarks && \
chown shiny:shiny /var/shinylogs/shiny-server/ && \
chown shiny:shiny /var/lib/shiny-server/bookmarks/
# --------------------------------------------------------
#
# expose the 3838 port
#
# --------------------------------------------------------
EXPOSE 3838
# --------------------------------------------------------
#
# copy over the startup script
#
# --------------------------------------------------------
COPY tools/passwd.template /passwd.template
COPY tools/run-server.sh /usr/bin/shiny-server.sh
COPY tools/run-test.sh /usr/bin/run-test.sh
RUN chmod a+x /usr/bin/shiny-server.sh
RUN chmod a+x /usr/bin/run-test.sh
# --------------------------------------------------------
#
# copy over your application and the supporting files in
# the data and www directory. This is done last because it
# is most likely to change frequently. This allows greater
# use of Docker caching as everying downstream of a change
# will invalidate the cache for those steps.
#
# --------------------------------------------------------
COPY app/ /srv/shiny-server/
RUN mkdir -p /srv/shiny-server/output/ && \
chown -R shiny:shiny /srv/shiny-server/
# --------------------------------------------------------
#
# run the server
#
# -----------------------------------------
#USER shiny
#CMD ["shiny-server"]
CMD ["/usr/bin/shiny-server.sh"]