## Based on the image RStudio with R 4.2.1 ----

FROM rocker/geospatial:4.2.1

MAINTAINER Marie-Caroline Prima <marie-caroline.prima@mnhn.fr>


## Copy local project ----

ENV folder="/home/rstudio/"

COPY . $folder
RUN chown -R rstudio:rstudio $folder


## Set working directory ----

WORKDIR $folder


## Install R packages ----

ENV RENV_VERSION 0.16.0

RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" \
 && R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')" \
 && sudo -u rstudio R -e "renv::restore()"

CMD R -e "source('make.R')"
