Create a Dockerfile based on either a sessionInfo, a workspace or a file.
dockerfile(from = utils::sessionInfo(), image = getImageForVersion(getRVersionTag(from)), maintainer = Sys.info()[["user"]], save_image = FALSE, envir = .GlobalEnv, env = list(generator = paste("containerit", utils::packageVersion("containerit"))), soft = FALSE, offline = FALSE, copy = NULL, container_workdir = "/payload/", cmd = "R", entrypoint = NULL, add_self = FALSE, silent = FALSE, predetect = TRUE, versioned_libs = FALSE, versioned_packages = FALSE, filter_baseimage_pkgs = FALSE)
from | The source of the information to construct the Dockerfile. Can be a |
---|---|
image | (From-object or character) Specifes the image that shall be used for the Docker container ( |
maintainer | Specify the maintainer of the Dockerfile. See documentation at 'https://docs.docker.com/engine/reference/builder/#maintainer'. Defaults to |
save_image | When TRUE, it calls save.image in the current working directory and copys the resulting |
envir | The environment for |
env | optionally specify environment variables to be included in the image. See documentation: 'https://docs.docker.com/engine/reference/builder/#env |
soft | (boolean) Whether to include soft dependencies when system dependencies are installed, default is no. |
offline | (boolean) Whether to use an online database to detect system dependencies or use local package information (slower!), default is no. |
copy | whether and how a workspace should be copied - values: "script", "script_dir" or a list of relative file paths to be copied, or |
container_workdir | the working directory in the container, defaults to |
cmd | The CMD statement that should be executed by default when running a parameter. Use |
entrypoint | the ENTRYPOINT statement for the Dockerfile |
add_self | Whether to add the package containerit itself if loaded/attached to the session |
silent | Whether or not to print information during execution |
predetect | Extract the required libraries based on |
versioned_libs | [EXPERIMENTAL] Whether it shall be attempted to match versions of linked external libraries |
versioned_packages | Whether it shall be attempted to match versions of R packages |
filter_baseimage_pkgs | Do not add packages from CRAN that are already installed in the base image. This does not apply to non-CRAN dependencies, e.g. packages install from GitHub. |
An object of class Dockerfile
sessionInfo
Use the current sessionInfo)
to create a Dockerfile.
Given an existing path to a directory, the method tries to automatically find the main R
file within that directory.
Files are searched recursively. The following types are supported:
regular R script files, identified by file names ending in .R
weaved documents, identified by file names ending in R Markdown (.Rmd
)
After identifying the main file, the process continues as described in the section file.
If both types are found, documents are given priority over scripts.
If multiple files are found, the first file as returned by dir
will be used.
Given an executable R
script or document, create a Dockerfile to execute this file.
This executes the whole file to obtain a complete sessionInfo
object, see section "Based on sessionInfo
", and copies required files and documents into the container.
dockerfile <- dockerfile()#> INFO [2019-08-20 16:43:57] Going online? TRUE ... to retrieve system dependencies (sysreq-api) #> INFO [2019-08-20 16:43:57] Trying to determine system requirements for the package(s) 'assertthat,automagic,backports,BiocManager,callr,cli,codetools,commonmark,crayon,curl,debugme,desc,devtools,digest,evaluate,fansi,formatR,fs,futile.logger,futile.options,glue,highlight,htmltools,httpuv,httr,jsonlite,knitr,lambda.r,later,magrittr,MASS,memoise,mime,miniUI,pillar,pkgbuild,pkgconfig,pkgdown,pkgload,prettyunits,processx,promises,ps,purrr,R6,Rcpp,rematch2,remotes,rjson,rlang,rmarkdown,roxygen2,rprojroot,rstudioapi,semver,sessioninfo,shiny,shinyFiles,stevedore,stringi,stringr,sysreqs,testthat,tibble,usethis,versions,whisker,withr,xfun,xml2,xtable,yaml' from sysreqs online DB #> INFO [2019-08-20 16:44:01] Adding CRAN packages: assertthat, automagic, backports, BiocManager, callr, cli, codetools, commonmark, crayon, curl, debugme, desc, devtools, digest, evaluate, fansi, formatR, fs, futile.logger, futile.options, glue, highlight, htmltools, httpuv, httr, jsonlite, knitr, lambda.r, later, magrittr, MASS, memoise, mime, miniUI, pillar, pkgbuild, pkgconfig, pkgdown, pkgload, prettyunits, processx, promises, ps, purrr, R6, Rcpp, rematch2, remotes, rjson, rlang, rmarkdown, roxygen2, rprojroot, rstudioapi, semver, sessioninfo, shiny, shinyFiles, stevedore, stringi, stringr, testthat, tibble, usethis, versions, whisker, withr, xfun, xml2, xtable, yaml #> INFO [2019-08-20 16:44:01] Adding GitHub packages: r-hub/sysreqs@3860f2b512a9c3bd3db6791c2ff467a1158f4048 #> INFO [2019-08-20 16:44:01] Created Dockerfile-Object based on sessionInfoprint(dockerfile)#> FROM rocker/r-ver:3.6.1 #> LABEL maintainer="daniel" #> RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \ #> && apt-get install -y git-core \ #> libcurl4-openssl-dev \ #> libssl-dev \ #> libxml2-dev \ #> make \ #> pandoc \ #> pandoc-citeproc #> RUN ["install2.r", "assertthat", "automagic", "backports", "BiocManager", "callr", "cli", "codetools", "commonmark", "crayon", "curl", "debugme", "desc", "devtools", "digest", "evaluate", "fansi", "formatR", "fs", "futile.logger", "futile.options", "glue", "highlight", "htmltools", "httpuv", "httr", "jsonlite", "knitr", "lambda.r", "later", "magrittr", "MASS", "memoise", "mime", "miniUI", "pillar", "pkgbuild", "pkgconfig", "pkgdown", "pkgload", "prettyunits", "processx", "promises", "ps", "purrr", "R6", "Rcpp", "rematch2", "remotes", "rjson", "rlang", "rmarkdown", "roxygen2", "rprojroot", "rstudioapi", "semver", "sessioninfo", "shiny", "shinyFiles", "stevedore", "stringi", "stringr", "testthat", "tibble", "usethis", "versions", "whisker", "withr", "xfun", "xml2", "xtable", "yaml"] #> RUN ["installGithub.r", "r-hub/sysreqs@3860f2b512a9c3bd3db6791c2ff467a1158f4048"] #> WORKDIR /payload/ #> CMD ["R"]