From 39697df50d14e79ac5fb176b955f742c0c6681b6 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:28:06 -0400 Subject: [PATCH 01/13] add `repo_get` function for fetching repo metadata using existing package dependencies --- R/dock_from_desc.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index c5c785f..6fcedde 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -331,3 +331,8 @@ repos_as_character <- function(repos) { repos_as_character } + +#' @noRd +repo_get <- function(repo) { + jsonlite::fromJSON(suppressMessages(system(glue::glue("curl -H \"Accept: application/vnd.github+json\" -H \"Authorization: token {remotes:::github_pat()}\" https://api.github.com/repos/{repo}"), intern = TRUE))) +} \ No newline at end of file From 116e8cab48fd2781850328e14c1e830200a666d8 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:28:42 -0400 Subject: [PATCH 02/13] Add `%|0|%` zero length replacement infix --- R/dock_from_desc.R | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 6fcedde..a8f9e75 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -335,4 +335,21 @@ repos_as_character <- function(repos) { #' @noRd repo_get <- function(repo) { jsonlite::fromJSON(suppressMessages(system(glue::glue("curl -H \"Accept: application/vnd.github+json\" -H \"Authorization: token {remotes:::github_pat()}\" https://api.github.com/repos/{repo}"), intern = TRUE))) -} \ No newline at end of file +} + +#' Replace zero-length values in a vector +#' @rdname op-zero-default +#' @param x \code{vctr} +#' @param y \code{object} to replace zero-length values. Must be of same class as x +#' +#' @return \code{vctr} +#' @export +#' +#' @examples +#' c(TRUE, FALSE, logical(0)) %|0|% FALSE +`%|0|%` <- Vectorize(function(x, y) { + if (rlang::is_empty(x)) + y + else + x +}) From da9dfef2c69bf49401ca6fafaf33482743248531 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:29:13 -0400 Subject: [PATCH 03/13] Add handling for private repos. --- R/dock_from_desc.R | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index a8f9e75..13ff859 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -206,7 +206,7 @@ dock_from_desc <- function( } if (length(packages_not_on_cran > 0)) { - nn <- as.data.frame( + nn_df <- as.data.frame( do.call( rbind, lapply( @@ -218,26 +218,46 @@ dock_from_desc <- function( ) ) + nn <- sprintf( + "%s/%s", + nn_df$username, + nn_df$repo + ) + + repo_status <- lapply(nn, repo_get) + ind_private <- sapply(repo_status, function(x) x$visibility == "private") %|0|% FALSE + if (any(ind_private)) { + dock$ARG("GITHUB_PAT") + dock$RUN("GITHUB_PAT=$GITHUB_PAT") + } + + nn <- sprintf( "%s/%s@%s", - nn$username, - nn$repo, - nn$sha + nn_df$username, + nn_df$repo, + nn_df$sha ) pong <- mapply( - function(dock, ver, nm) { + function(dock, ver, nm, i) { + fmt <- "Rscript -e 'remotes::install_github(\"%s\")'" + if (i) + fmt <- paste("GITHUB_PAT=$GITHUB_PAT", fmt) res <- dock$RUN( sprintf( - "Rscript -e 'remotes::install_github(\"%s\")'", + fmt, ver ) ) }, ver = nn, + i = ind_private, MoreArgs = list(dock = dock) ) + cat_info(glue::glue("Must add --build-arg GITHUB_PAT={remotes:::github_pat()} to docker build call. Note that the GITHUB_PAT will be visible in this image metadata. If uploaded to Docker Hub, the visibility must be set to private to avoid exposing the GITHUB_PAT.")) + dock$custom("#", "Must add --build-arg GITHUB_PAT=[YOUR GITHUB PAT] to docker build call") } if (!build_from_source) { From a17104edb683c0eba83ca0e1368fdd3973a5b1a3 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:29:20 -0400 Subject: [PATCH 04/13] Update Docs --- NAMESPACE | 1 + man/op-zero-default.Rd | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 man/op-zero-default.Rd diff --git a/NAMESPACE b/NAMESPACE index b0d7967..a3dd399 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export("%|0|%") export(Dockerfile) export(dock_from_desc) export(dock_from_renv) diff --git a/man/op-zero-default.Rd b/man/op-zero-default.Rd new file mode 100644 index 0000000..3611ba4 --- /dev/null +++ b/man/op-zero-default.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dock_from_desc.R +\name{\%|0|\%} +\alias{\%|0|\%} +\title{Replace zero-length values in a vector} +\usage{ +x \%|0|\% y +} +\arguments{ +\item{x}{\code{vctr}} + +\item{y}{\code{object} to replace zero-length values. Must be of same class as x} +} +\value{ +\code{vctr} +} +\description{ +Replace zero-length values in a vector +} +\examples{ +c(TRUE, FALSE, logical(0)) \%|0|\% FALSE +} From 7f0529fe1881d8e4abd6d10310b39e0e03c6c6d3 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:34:40 -0400 Subject: [PATCH 05/13] Add handling for private repos during `install_local` step --- R/dock_from_desc.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 13ff859..067ce73 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -323,7 +323,10 @@ dock_from_desc <- function( dock$RUN("mkdir /build_zone") dock$ADD(from = ".", to = "/build_zone") dock$WORKDIR("/build_zone") - dock$RUN("R -e 'remotes::install_local(upgrade=\"never\")'") + run <- "R -e 'remotes::install_local(upgrade=\"never\")'" + if (any(get0("ind_private", inherits = FALSE))) + paste("GITHUB_PAT=$GITHUB_PAT", run) + dock$RUN(run) dock$RUN("rm -rf /build_zone") } # Add a dockerignore From 25b6682f64903ddc43a5b300cf5508f6cf7d3f3f Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 12 Jul 2022 21:59:50 -0400 Subject: [PATCH 06/13] Improve message, fix conditional on install_local --- R/dock_from_desc.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 067ce73..d159b9f 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -256,8 +256,8 @@ dock_from_desc <- function( i = ind_private, MoreArgs = list(dock = dock) ) - cat_info(glue::glue("Must add --build-arg GITHUB_PAT={remotes:::github_pat()} to docker build call. Note that the GITHUB_PAT will be visible in this image metadata. If uploaded to Docker Hub, the visibility must be set to private to avoid exposing the GITHUB_PAT.")) - dock$custom("#", "Must add --build-arg GITHUB_PAT=[YOUR GITHUB PAT] to docker build call") + cat_red_bullet(glue::glue("Must add `--build-arg GITHUB_PAT={remotes:::github_pat()}` to `docker build` call. Note that the GITHUB_PAT will be visible in this image metadata. If uploaded to Docker Hub, the visibility must be set to private to avoid exposing the GITHUB_PAT.")) + dock$custom("#", "Must add `--build-arg GITHUB_PAT=[YOUR GITHUB PAT]` to `docker build` call") } if (!build_from_source) { @@ -325,7 +325,7 @@ dock_from_desc <- function( dock$WORKDIR("/build_zone") run <- "R -e 'remotes::install_local(upgrade=\"never\")'" if (any(get0("ind_private", inherits = FALSE))) - paste("GITHUB_PAT=$GITHUB_PAT", run) + run <- paste("GITHUB_PAT=$GITHUB_PAT", run) dock$RUN(run) dock$RUN("rm -rf /build_zone") } From db5e9832b027afd7da2c3325413bd90008e61e6a Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 19 Jul 2022 14:03:31 -0400 Subject: [PATCH 07/13] Add support for specifying a hash for the R build to use. --- R/dock_from_desc.R | 6 ++++++ man/dockerfiles.Rd | 3 +++ 2 files changed, 9 insertions(+) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index d159b9f..28acf39 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -36,6 +36,7 @@ base_pkg_ <- c( #' @param FROM The FROM of the Dockerfile. Default is #' FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`. #' @param AS The AS of the Dockerfile. Default it NULL. +#' @param sha256 The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built. #' @param sysreqs boolean. If TRUE, the Dockerfile will contain sysreq installation. #' @param repos character. The URL(s) of the repositories to use for `options("repos")`. #' @param expand boolean. If `TRUE` each system requirement will have its own `RUN` line. @@ -64,6 +65,7 @@ dock_from_desc <- function( ".", R.Version()$minor ), + sha256 = NULL, AS = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), @@ -146,6 +148,10 @@ dock_from_desc <- function( packages_with_version$package ) + # Add SHA for Architecture + if (!is.null(sha256)) + FROM <- paste0(FROM, "@sha256:", sha256) + dock <- Dockerfile$new( FROM = FROM, AS = AS diff --git a/man/dockerfiles.Rd b/man/dockerfiles.Rd index 413d3d3..cc00eb9 100644 --- a/man/dockerfiles.Rd +++ b/man/dockerfiles.Rd @@ -7,6 +7,7 @@ dock_from_desc( path = "DESCRIPTION", FROM = paste0("rocker/r-ver:", R.Version()$major, ".", R.Version()$minor), + sha256 = NULL, AS = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), @@ -22,6 +23,8 @@ dock_from_desc( \item{FROM}{The FROM of the Dockerfile. Default is FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`.} +\item{sha256}{The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built.} + \item{AS}{The AS of the Dockerfile. Default it NULL.} \item{sysreqs}{boolean. If TRUE, the Dockerfile will contain sysreq installation.} From 2ee7cc799d9ea61681430c03da177c4785e4e832 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 19 Jul 2022 16:56:35 -0400 Subject: [PATCH 08/13] Add support for excluding Suggests dependencies --- R/dock_from_desc.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 28acf39..626958f 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -67,6 +67,7 @@ dock_from_desc <- function( ), sha256 = NULL, AS = NULL, + use_suggests = TRUE, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, @@ -76,7 +77,10 @@ dock_from_desc <- function( ) { path <- fs::path_abs(path) - packages <- desc_get_deps(path)$package + packages <- desc_get_deps(path) + if (!use_suggests) + packages <- packages[packages$type != "Suggests",] + packages <- packages$package packages <- packages[packages != "R"] # remove R packages <- packages[!packages %in% base_pkg_] # remove base and recommended From 2e2582588518e7fd88ef0399148b7005a46eb311 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 19 Jul 2022 16:58:12 -0400 Subject: [PATCH 09/13] Doc updates --- R/dock_from_desc.R | 3 ++- man/dockerfiles.Rd | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 626958f..54d490d 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -36,8 +36,9 @@ base_pkg_ <- c( #' @param FROM The FROM of the Dockerfile. Default is #' FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`. #' @param AS The AS of the Dockerfile. Default it NULL. -#' @param sha256 The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built. +#' @param sha256 character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built. #' @param sysreqs boolean. If TRUE, the Dockerfile will contain sysreq installation. +#' @param use_suggests boolean. If TRUE (the default), include dependencies listed in Suggests field in DESCRIPTION. #' @param repos character. The URL(s) of the repositories to use for `options("repos")`. #' @param expand boolean. If `TRUE` each system requirement will have its own `RUN` line. #' @param build_from_source boolean. If `TRUE` no tar.gz is created and diff --git a/man/dockerfiles.Rd b/man/dockerfiles.Rd index cc00eb9..944ca32 100644 --- a/man/dockerfiles.Rd +++ b/man/dockerfiles.Rd @@ -9,6 +9,7 @@ dock_from_desc( FROM = paste0("rocker/r-ver:", R.Version()$major, ".", R.Version()$minor), sha256 = NULL, AS = NULL, + use_suggests = TRUE, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, @@ -23,10 +24,12 @@ dock_from_desc( \item{FROM}{The FROM of the Dockerfile. Default is FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`.} -\item{sha256}{The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built.} +\item{sha256}{character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built.} \item{AS}{The AS of the Dockerfile. Default it NULL.} +\item{use_suggests}{boolean. If TRUE (the default), include dependencies listed in Suggests field in DESCRIPTION.} + \item{sysreqs}{boolean. If TRUE, the Dockerfile will contain sysreq installation.} \item{repos}{character. The URL(s) of the repositories to use for `options("repos")`.} From ffb36ac780c46042ddac795678102244d85d0742 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 19 Jul 2022 17:22:56 -0400 Subject: [PATCH 10/13] Alphabetize dependencies --- R/dock_from_desc.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 54d490d..734025d 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -83,7 +83,7 @@ dock_from_desc <- function( packages <- packages[packages$type != "Suggests",] packages <- packages$package packages <- packages[packages != "R"] # remove R - packages <- packages[!packages %in% base_pkg_] # remove base and recommended + packages <- sort(packages[!packages %in% base_pkg_]) # remove base and recommended if (sysreqs) { From 7a1a4048fd20159b2df49d70af2e062364b74ef2 Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Tue, 19 Jul 2022 19:10:27 -0400 Subject: [PATCH 11/13] Fix ordering of packages in Dockerfile --- R/dock_from_desc.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 734025d..7d1efa6 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -83,7 +83,7 @@ dock_from_desc <- function( packages <- packages[packages$type != "Suggests",] packages <- packages$package packages <- packages[packages != "R"] # remove R - packages <- sort(packages[!packages %in% base_pkg_]) # remove base and recommended + packages <- packages[!packages %in% base_pkg_] # remove base and recommended if (sysreqs) { @@ -134,10 +134,10 @@ dock_from_desc <- function( packages ) - packages_not_on_cran <- setdiff( + packages_not_on_cran <- sort(setdiff( packages, packages_on_cran - ) + )) packages_with_version <- data.frame( package = remotes_deps$package, @@ -153,6 +153,7 @@ dock_from_desc <- function( packages_with_version$package ) + packages_on_cran <- packages_on_cran[order(names(packages_on_cran))] # Add SHA for Architecture if (!is.null(sha256)) FROM <- paste0(FROM, "@sha256:", sha256) From a7c3658f78a06f8023019be88eb15750abf486ad Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Mon, 2 Jan 2023 11:48:24 -0500 Subject: [PATCH 12/13] Better sha256 documentation --- R/dock_from_desc.R | 2 +- R/dock_from_renv.R | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/dock_from_desc.R b/R/dock_from_desc.R index 7d1efa6..a663bcf 100644 --- a/R/dock_from_desc.R +++ b/R/dock_from_desc.R @@ -36,7 +36,7 @@ base_pkg_ <- c( #' @param FROM The FROM of the Dockerfile. Default is #' FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`. #' @param AS The AS of the Dockerfile. Default it NULL. -#' @param sha256 character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built. +#' @param sha256 character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine. This will need to be set in instances where the machine on which the image is built is different than the machine on which the image will be hosted/deployed. This is a convenience for setting `FROM = rocker/rver@sha256:xxxx` #' @param sysreqs boolean. If TRUE, the Dockerfile will contain sysreq installation. #' @param use_suggests boolean. If TRUE (the default), include dependencies listed in Suggests field in DESCRIPTION. #' @param repos character. The URL(s) of the repositories to use for `options("repos")`. diff --git a/R/dock_from_renv.R b/R/dock_from_renv.R index a77d0a6..ad23508 100644 --- a/R/dock_from_renv.R +++ b/R/dock_from_renv.R @@ -13,6 +13,7 @@ available_distros <- c( #' @param FROM Docker image to start FROM Default is #' FROM rocker/r-base #' @param AS The AS of the Dockerfile. Default it NULL. +#' @param sha256 character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine. This will need to be set in instances where the machine on which the image is built is different than the machine on which the image will be hosted/deployed. This is a convenience for setting `FROM = rocker/rver@sha256:xxxx` #' @param distro One of "focal", "bionic", "xenial", "centos7", #' or "centos8". See available distributions #' at https://hub.docker.com/r/rstudio/r-base/. @@ -48,6 +49,7 @@ dock_from_renv <- function( lockfile = "renv.lock", distro = "focal", FROM = "rocker/r-base", + sha256 = NULL, AS = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), @@ -61,6 +63,9 @@ dock_from_renv <- function( # lock$repos(CRAN = repos) lockfile <- basename(lockfile) + # Add SHA for Architecture + if (!is.null(sha256)) + FROM <- paste0(FROM, "@sha256:", sha256) # start the dockerfile R_major_minor <- lock$data()$R$Version dock <- Dockerfile$new( From 4f4b56e824ebdbbb0b45f414b9d97f5276d9c2eb Mon Sep 17 00:00:00 2001 From: Stephen Holsenbeck Date: Mon, 2 Jan 2023 11:49:28 -0500 Subject: [PATCH 13/13] Documentation from previous commit --- man/Dockerfile.Rd | 150 +++++++++++++++++++++--------------------- man/dock_from_renv.Rd | 3 + man/dockerfiles.Rd | 2 +- 3 files changed, 79 insertions(+), 76 deletions(-) diff --git a/man/Dockerfile.Rd b/man/Dockerfile.Rd index 90bf687..1964c52 100644 --- a/man/Dockerfile.Rd +++ b/man/Dockerfile.Rd @@ -46,36 +46,36 @@ my_dock <- Dockerfile$new() \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{Dockerfile$new()}} -\item \href{#method-RUN}{\code{Dockerfile$RUN()}} -\item \href{#method-ADD}{\code{Dockerfile$ADD()}} -\item \href{#method-COPY}{\code{Dockerfile$COPY()}} -\item \href{#method-WORKDIR}{\code{Dockerfile$WORKDIR()}} -\item \href{#method-EXPOSE}{\code{Dockerfile$EXPOSE()}} -\item \href{#method-VOLUME}{\code{Dockerfile$VOLUME()}} -\item \href{#method-CMD}{\code{Dockerfile$CMD()}} -\item \href{#method-LABEL}{\code{Dockerfile$LABEL()}} -\item \href{#method-ENV}{\code{Dockerfile$ENV()}} -\item \href{#method-ENTRYPOINT}{\code{Dockerfile$ENTRYPOINT()}} -\item \href{#method-USER}{\code{Dockerfile$USER()}} -\item \href{#method-ARG}{\code{Dockerfile$ARG()}} -\item \href{#method-ONBUILD}{\code{Dockerfile$ONBUILD()}} -\item \href{#method-STOPSIGNAL}{\code{Dockerfile$STOPSIGNAL()}} -\item \href{#method-HEALTHCHECK}{\code{Dockerfile$HEALTHCHECK()}} -\item \href{#method-SHELL}{\code{Dockerfile$SHELL()}} -\item \href{#method-MAINTAINER}{\code{Dockerfile$MAINTAINER()}} -\item \href{#method-custom}{\code{Dockerfile$custom()}} -\item \href{#method-print}{\code{Dockerfile$print()}} -\item \href{#method-write}{\code{Dockerfile$write()}} -\item \href{#method-switch_cmd}{\code{Dockerfile$switch_cmd()}} -\item \href{#method-remove_cmd}{\code{Dockerfile$remove_cmd()}} -\item \href{#method-add_after}{\code{Dockerfile$add_after()}} -\item \href{#method-clone}{\code{Dockerfile$clone()}} +\item \href{#method-Dockerfile-new}{\code{Dockerfile$new()}} +\item \href{#method-Dockerfile-RUN}{\code{Dockerfile$RUN()}} +\item \href{#method-Dockerfile-ADD}{\code{Dockerfile$ADD()}} +\item \href{#method-Dockerfile-COPY}{\code{Dockerfile$COPY()}} +\item \href{#method-Dockerfile-WORKDIR}{\code{Dockerfile$WORKDIR()}} +\item \href{#method-Dockerfile-EXPOSE}{\code{Dockerfile$EXPOSE()}} +\item \href{#method-Dockerfile-VOLUME}{\code{Dockerfile$VOLUME()}} +\item \href{#method-Dockerfile-CMD}{\code{Dockerfile$CMD()}} +\item \href{#method-Dockerfile-LABEL}{\code{Dockerfile$LABEL()}} +\item \href{#method-Dockerfile-ENV}{\code{Dockerfile$ENV()}} +\item \href{#method-Dockerfile-ENTRYPOINT}{\code{Dockerfile$ENTRYPOINT()}} +\item \href{#method-Dockerfile-USER}{\code{Dockerfile$USER()}} +\item \href{#method-Dockerfile-ARG}{\code{Dockerfile$ARG()}} +\item \href{#method-Dockerfile-ONBUILD}{\code{Dockerfile$ONBUILD()}} +\item \href{#method-Dockerfile-STOPSIGNAL}{\code{Dockerfile$STOPSIGNAL()}} +\item \href{#method-Dockerfile-HEALTHCHECK}{\code{Dockerfile$HEALTHCHECK()}} +\item \href{#method-Dockerfile-SHELL}{\code{Dockerfile$SHELL()}} +\item \href{#method-Dockerfile-MAINTAINER}{\code{Dockerfile$MAINTAINER()}} +\item \href{#method-Dockerfile-custom}{\code{Dockerfile$custom()}} +\item \href{#method-Dockerfile-print}{\code{Dockerfile$print()}} +\item \href{#method-Dockerfile-write}{\code{Dockerfile$write()}} +\item \href{#method-Dockerfile-switch_cmd}{\code{Dockerfile$switch_cmd()}} +\item \href{#method-Dockerfile-remove_cmd}{\code{Dockerfile$remove_cmd()}} +\item \href{#method-Dockerfile-add_after}{\code{Dockerfile$add_after()}} +\item \href{#method-Dockerfile-clone}{\code{Dockerfile$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-new}{}}} \subsection{Method \code{new()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$new(FROM = "rocker/r-base", AS = NULL)}\if{html}{\out{
}} @@ -83,8 +83,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-RUN}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-RUN}{}}} \subsection{Method \code{RUN()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$RUN(cmd)}\if{html}{\out{
}} @@ -92,8 +92,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ADD}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-ADD}{}}} \subsection{Method \code{ADD()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$ADD(from, to, force = TRUE)}\if{html}{\out{
}} @@ -101,8 +101,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-COPY}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-COPY}{}}} \subsection{Method \code{COPY()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$COPY(from, to, force = TRUE)}\if{html}{\out{
}} @@ -110,8 +110,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-WORKDIR}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-WORKDIR}{}}} \subsection{Method \code{WORKDIR()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$WORKDIR(where)}\if{html}{\out{
}} @@ -119,8 +119,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-EXPOSE}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-EXPOSE}{}}} \subsection{Method \code{EXPOSE()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$EXPOSE(port)}\if{html}{\out{
}} @@ -128,8 +128,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-VOLUME}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-VOLUME}{}}} \subsection{Method \code{VOLUME()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$VOLUME(volume)}\if{html}{\out{
}} @@ -137,8 +137,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-CMD}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-CMD}{}}} \subsection{Method \code{CMD()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$CMD(cmd)}\if{html}{\out{
}} @@ -146,8 +146,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-LABEL}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-LABEL}{}}} \subsection{Method \code{LABEL()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$LABEL(key, value)}\if{html}{\out{
}} @@ -155,8 +155,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ENV}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-ENV}{}}} \subsection{Method \code{ENV()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$ENV(key, value)}\if{html}{\out{
}} @@ -164,8 +164,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ENTRYPOINT}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-ENTRYPOINT}{}}} \subsection{Method \code{ENTRYPOINT()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$ENTRYPOINT(cmd)}\if{html}{\out{
}} @@ -173,8 +173,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-USER}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-USER}{}}} \subsection{Method \code{USER()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$USER(user)}\if{html}{\out{
}} @@ -182,8 +182,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ARG}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-ARG}{}}} \subsection{Method \code{ARG()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$ARG(arg, ahead = FALSE)}\if{html}{\out{
}} @@ -191,8 +191,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ONBUILD}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-ONBUILD}{}}} \subsection{Method \code{ONBUILD()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$ONBUILD(cmd)}\if{html}{\out{
}} @@ -200,8 +200,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-STOPSIGNAL}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-STOPSIGNAL}{}}} \subsection{Method \code{STOPSIGNAL()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$STOPSIGNAL(signal)}\if{html}{\out{
}} @@ -209,8 +209,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-HEALTHCHECK}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-HEALTHCHECK}{}}} \subsection{Method \code{HEALTHCHECK()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$HEALTHCHECK(check)}\if{html}{\out{
}} @@ -218,8 +218,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-SHELL}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-SHELL}{}}} \subsection{Method \code{SHELL()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$SHELL(shell)}\if{html}{\out{
}} @@ -227,8 +227,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-MAINTAINER}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-MAINTAINER}{}}} \subsection{Method \code{MAINTAINER()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$MAINTAINER(name, email)}\if{html}{\out{
}} @@ -236,8 +236,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-custom}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-custom}{}}} \subsection{Method \code{custom()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$custom(base, cmd)}\if{html}{\out{
}} @@ -245,8 +245,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-print}{}}} \subsection{Method \code{print()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$print()}\if{html}{\out{
}} @@ -254,8 +254,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-write}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-write}{}}} \subsection{Method \code{write()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$write(as = "Dockerfile")}\if{html}{\out{
}} @@ -263,8 +263,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-switch_cmd}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-switch_cmd}{}}} \subsection{Method \code{switch_cmd()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$switch_cmd(a, b)}\if{html}{\out{
}} @@ -272,8 +272,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-remove_cmd}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-remove_cmd}{}}} \subsection{Method \code{remove_cmd()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$remove_cmd(where)}\if{html}{\out{
}} @@ -281,8 +281,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-add_after}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-add_after}{}}} \subsection{Method \code{add_after()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Dockerfile$add_after(cmd, after)}\if{html}{\out{
}} @@ -290,8 +290,8 @@ my_dock <- Dockerfile$new() } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Dockerfile-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/dock_from_renv.Rd b/man/dock_from_renv.Rd index 1b02558..ed07f53 100644 --- a/man/dock_from_renv.Rd +++ b/man/dock_from_renv.Rd @@ -8,6 +8,7 @@ dock_from_renv( lockfile = "renv.lock", distro = "focal", FROM = "rocker/r-base", + sha256 = NULL, AS = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), @@ -25,6 +26,8 @@ at https://hub.docker.com/r/rstudio/r-base/.} \item{FROM}{Docker image to start FROM Default is FROM rocker/r-base} +\item{sha256}{character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine. This will need to be set in instances where the machine on which the image is built is different than the machine on which the image will be hosted/deployed. This is a convenience for setting `FROM = rocker/rver@sha256:xxxx`} + \item{AS}{The AS of the Dockerfile. Default it NULL.} \item{sysreqs}{boolean. If `TRUE`, the Dockerfile diff --git a/man/dockerfiles.Rd b/man/dockerfiles.Rd index 944ca32..38cdddb 100644 --- a/man/dockerfiles.Rd +++ b/man/dockerfiles.Rd @@ -24,7 +24,7 @@ dock_from_desc( \item{FROM}{The FROM of the Dockerfile. Default is FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`.} -\item{sha256}{character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine if different than the machine on which the image will be built.} +\item{sha256}{character. The Digest SHA256 hash corresponding to the chip architecture of the deployment host machine. This will need to be set in instances where the machine on which the image is built is different than the machine on which the image will be hosted/deployed. This is a convenience for setting `FROM = rocker/rver@sha256:xxxx`} \item{AS}{The AS of the Dockerfile. Default it NULL.}