-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
46 lines (36 loc) · 1.26 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
FROM rocker/verse:3.6.3
LABEL maintainer="Author"
LABEL email="[email protected]"
# ---------------------------------------------
# Argument to specify date of R packages
# ---------------------------------------------
ARG WHEN
# ---------------------------------------------
# Install major Linux libraries
# ---------------------------------------------
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
zip \
unzip
# ---------------------------------------------
# Set up work environment and R library paths
# ---------------------------------------------
ENV NB_USER rstudio
RUN echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron
RUN echo "export PATH=${PATH}" >> ${HOME}/.profile
ENV LD_LIBRARY_PATH /usr/local/lib/R/lib
ENV HOME /home/${NB_USER}
WORKDIR ${HOME}
USER root
# ---------------------------------------------
# Copy files to image, and execute code
# ---------------------------------------------
COPY . ${HOME}
# install packages using DESCRIPTION file
RUN if [ -f DESCRIPTION ]; \
then R --quiet -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/${WHEN}')); \
install.packages('remotes'); \
remotes::install_deps()"; \
fi
CMD Rscript analysis.R
RUN chown -R ${NB_USER} ${HOME}