Skip to content

Commit a7c3658

Browse files
author
Stephen Holsenbeck
committed
Better sha256 documentation
1 parent 7a1a404 commit a7c3658

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

R/dock_from_desc.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ base_pkg_ <- c(
3636
#' @param FROM The FROM of the Dockerfile. Default is
3737
#' FROM rocker/r-ver:`R.Version()$major`.`R.Version()$minor`.
3838
#' @param AS The AS of the Dockerfile. Default it NULL.
39-
#' @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.
39+
#' @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`
4040
#' @param sysreqs boolean. If TRUE, the Dockerfile will contain sysreq installation.
4141
#' @param use_suggests boolean. If TRUE (the default), include dependencies listed in Suggests field in DESCRIPTION.
4242
#' @param repos character. The URL(s) of the repositories to use for `options("repos")`.

R/dock_from_renv.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ available_distros <- c(
1313
#' @param FROM Docker image to start FROM Default is
1414
#' FROM rocker/r-base
1515
#' @param AS The AS of the Dockerfile. Default it NULL.
16+
#' @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`
1617
#' @param distro One of "focal", "bionic", "xenial", "centos7",
1718
#' or "centos8". See available distributions
1819
#' at https://hub.docker.com/r/rstudio/r-base/.
@@ -48,6 +49,7 @@ dock_from_renv <- function(
4849
lockfile = "renv.lock",
4950
distro = "focal",
5051
FROM = "rocker/r-base",
52+
sha256 = NULL,
5153
AS = NULL,
5254
sysreqs = TRUE,
5355
repos = c(CRAN = "https://cran.rstudio.com/"),
@@ -61,6 +63,9 @@ dock_from_renv <- function(
6163
# lock$repos(CRAN = repos)
6264
lockfile <- basename(lockfile)
6365

66+
# Add SHA for Architecture
67+
if (!is.null(sha256))
68+
FROM <- paste0(FROM, "@sha256:", sha256)
6469
# start the dockerfile
6570
R_major_minor <- lock$data()$R$Version
6671
dock <- Dockerfile$new(

0 commit comments

Comments
 (0)