-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (38 loc) · 1.36 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
FROM rocker/r-base:4.1.3
# set work directory
WORKDIR /opt
# set argument for git access token
ARG GIT_ACCESS_TOKEN
ENV GITHUB_PAT ${GIT_ACCESS_TOKEN}
# Install libraries
RUN apt update && \
apt install -y libxml2-dev \
libcurl4-openssl-dev \
libssl-dev \
libfftw3-dev \
libtiff-dev \
libgsl-dev \
git \
procps
# set git credentials
RUN git config --global credential.helper \
'!f() { echo username=author; echo "password=${GIT_ACCESS_TOKEN}"; };f'
# Install renv
ENV RENV_VERSION 0.15.4
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" && \
R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"
# Add ENV variables for Renv cache (not symlink)
RUN mkdir /opt/renvcache && \
echo RENV_PATHS_CACHE='/opt/renvcache' >> $(R RHOME)/etc/Renviron.site
# set the renv project directory as the renv default dir
ENV RENV_DIR='/opt/ASURAT'
# clone repo, install packages and move symlinks
RUN git clone https://github.com/keita-iida/ASURAT.git && \
cd ASURAT && \
R -e 'renv::restore()' && \
R CMD INSTALL . && \
chmod +x /opt/ASURAT/inst/*.R && \
mv $(cd $RENV_DIR && Rscript -e "cat(paste0(renv::paths\$library()))") /opt/Rlibsymlinks && \
echo "R_LIBS=/opt/Rlibsymlinks" >> $(R RHOME)/etc/Renviron.site
# set environment variables for R scripts within package
ENV PATH=/opt/ASURAT/inst:$PATH