dock_from_renv: Create a Dockerfile from an 'renv.lock' file

View source: R/dock_from_renv.R

dock_from_renvR Documentation

Create a Dockerfile from an renv.lock file

Description

Create a Dockerfile from an renv.lock file

Usage

dock_from_renv(
  lockfile = "renv.lock",
  distro = "focal",
  FROM = "rocker/r-base",
  AS = NULL,
  sysreqs = TRUE,
  repos = c(CRAN = "https://cran.rstudio.com/"),
  expand = FALSE,
  extra_sysreqs = NULL,
  use_pak = FALSE,
  renv_version
)

Arguments

lockfile

Path to an renv.lock file to use as an input..

distro

One of "focal", "bionic", "xenial", "centos7",or "centos8". See available distributions at https://hub.docker.com/r/rstudio/r-base/.

FROM

Docker image to start FROM Default is FROM rocker/r-base

AS

The AS of the Dockerfile. Default it NULL.

sysreqs

boolean. If TRUE, the Dockerfile will contain sysreq installation.

repos

character. The URL(s) of the repositories to use for options("repos").

expand

boolean. If TRUE each system requirement will have its own RUN line.

extra_sysreqs

character vector. Extra debian system requirements. Will be installed with apt-get install.

use_pak

boolean. If TRUE use pak to deal with dependencies during renv::restore(). FALSE by default

renv_version

character. The renv version to use in the generated Dockerfile. By default, it is set to the version specified in the renv.lock file. If the renv.lock file does not specify a renv version, the version of renv bundled with dockerfiler, specifically 1.0.3, will be used. If you set it to NULL, the latest available version of renv will be used.

Details

System requirements for packages are provided through RStudio Package Manager via the pak package. The install commands provided from pak are added as RUN directives within the Dockerfile.

The R version is taken from the renv.lock file. Packages are installed using renv::restore() which ensures that the proper package version and source is used when installed.

Value

A R6 object of class Dockerfile.

Examples

## Not run: 
dock <- dock_from_renv("renv.lock", distro = "xenial")
dock$write("Dockerfile")

## End(Not run)

ColinFay/dockerfiler documentation built on Nov. 16, 2023, 8:33 p.m.