dockerfiler
dockerfiler copied to clipboard
`FROM` overwrites options from `distro` making broken Dockerfiles
The default FROM
argument is rocker/r-base
which is a debian image. Using the distro
arg helps find the appropriate system dependencies. the FROM
argument will always be rocker/r-base
for all distro
values.
For example a simple renv.lock file with the following call
dock <- dockerfiler::dock_from_renv(distro = "centos8")
dock$write()
Generated this dockerfile
FROM rocker/r-base:4.3.0
RUN yum update -y && dnf install -y libcurl-devel
RUN dnf install -y openssl-devel
# ......truncated for brevity.....
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(renv.config.pak.enabled = TRUE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages(c("renv","remotes"))'
COPY renv.lock renv.lock
RUN R -e 'renv::restore()'
If pak is to be used for identifying system dependencies, I believe the FROM
argument should be removed and the FROM statement derived from the distro
argument so that the base image and the system dep commands are in agreement.
https://github.com/ThinkR-open/dockerfiler/blob/e40f804e9728afb9bb5a8c52d965c9ac4a8fd58a/R/dock_from_renv.R#L50