R/set_label.R

Defines functions set_label

Documented in set_label

#' Add label metadata to an image
#'
#' @param dockerfile a specification of the contents of the dockerfile
#' @param label_vars A named vector of labels and their values
#'
#' @return `dockerfile`, a specification of the contents of the dockerfile
#' @export
#'
#' @examples
#' dockerfile() %>%
#' set_label(c("label_1"="value_1", "label_2"="value_2"))
#'
set_label <- function(dockerfile, label_vars){
  ret <- c(dockerfile,
    'LABEL' = paste0('"',names(label_vars),'"="', label_vars,'"', collapse = ' ')) %>%
    insert_blank()

  return(ret)
}
uncoast-unconf/whaler documentation built on Oct. 31, 2020, 9:10 p.m.