Skip to content

FROM overwrites options from distro making broken Dockerfiles #58

@JosiahParry

Description

@JosiahParry

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.

FROM = "rocker/r-base",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions