Open ColinFay opened 2 years ago
As said here: https://github.com/ThinkR-open/golem/issues/282#issuecomment-891118964
A new test today with a combination of {renv} and Docker cache requires:
a .dockerignore with renv and .Rprofile ignored as suggested by jcpsantiago :
.RData
.Rhistory
.git
.gitignore
manifest.json
rsconnect/
Rproj.user
.Rprofile
renv/
A Dockerfile like this that forces {renv} to use the classical path to install dependencies with renv::restore(library = .libPaths())
:
renv::status()
up-to-date, so that currently installed versions are the same as in "renv.lock" renv::restore()
renv::restore()
will be called again as it appears after WORKDIR
FROM rocker/geospatial:4.0.1
RUN apt-get update && apt-get install -y gdal-bin git-core libcairo2-dev libcurl4-openssl-dev libgdal-dev libgeos-dev libgeos++-dev libgit2-dev libicu-dev libpng-dev libpq-dev libproj-dev libssl-dev libudunits2-dev libxml2-dev make pandoc pandoc-citeproc zlib1g-dev && rm -rf /var/lib/apt/lists/*
RUN echo "options(repos = c(CRAN = 'https://packagemanager.rstudio.com/all/__linux__/focal/latest'), download.file.method = 'libcurl')" >> /usr/local/lib/R/etc/Rprofile.site
RUN echo "options(warn = 2);" >> $R_HOME/etc/Rprofile.site
RUN Rscript -e 'install.packages("remotes")' RUN Rscript -e 'remotes::install_version("stringr",upgrade="never", version = "1.4.0")' RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.4.2")' RUN Rscript -e 'remotes::install_version("magrittr",upgrade="never", version = "2.0.1")' RUN Rscript -e 'remotes::install_version("future",upgrade="never", version = "1.21.0")' RUN Rscript -e 'remotes::install_version("cartography",upgrade="never", version = "2.4.2")' RUN Rscript -e 'remotes::install_github("Thinkr-open/golem@aaae5c8788802a7b4aef4df23691902a286dd964")'
RUN Rscript -e 'remotes::install_github("rstudio/renv")' RUN mkdir /build_zone ADD . /build_zone WORKDIR /build_zone
RUN Rscript -e 'renv::restore(library = .libPaths())' RUN Rscript -e 'remotes::install_local(upgrade = FALSE)' RUN rm -rf /build_zone
RUN echo "options(warn = -1);" >> $R_HOME/etc/Rprofile.site
EXPOSE 3838 CMD ["R", "-e", "options('shiny.port'=3838,shiny.host='0.0.0.0');mygolem::run_app()"]
Note: there is a WIP here https://github.com/ColinFay/dockerfiler/pull/22
That should be good now.
Worth noting that this might be ready to be closed
Related issues : https://github.com/ThinkR-open/golem/issues/656