Skip to content

Commit

Permalink
add run_args
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Jul 14, 2017
1 parent ab7da54 commit 7cdf2fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
17 changes: 10 additions & 7 deletions R/render_docker.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#' @param input Input file to render in Docker container.
#' @param tag Docker image name to build, sent as docker argument \code{-t}.
#' If not specified, it will use the same name as the input file.
#' @param build_args A character string specifying additional
#' \code{docker build} arguments. For example,
#' \code{--pull=true -m="1024m" --memory-swap="-1"}.
#' @param container_name Docker container name to run.
#' If not specified, will use a randomly generated name.
#' @param cache Logical. Controls the \code{--no-cache} argument
Expand All @@ -30,6 +27,11 @@
#' @param purge_info Logical. Should we write the Docker container and
#' image information to a YAML file for purging later?
#' Default is \code{TRUE}.
#' @param build_args A character string specifying additional
#' \code{docker build} arguments. For example,
#' \code{--pull=true -m="1024m" --memory-swap="-1"}.
#' @param run_args A character string specifying additional
#' \code{docker run} arguments. For example, \code{--privileged=true}.
#' @param ... Additional arguments passed to
#' \code{\link[rmarkdown]{render}}.
#'
Expand Down Expand Up @@ -71,9 +73,9 @@
#' purge_image(paste0(dir_example, "liftr-tidyverse.docker.yml"))}

render_docker = function(
input = NULL,
tag = NULL, build_args = NULL, container_name = NULL,
cache = TRUE, purge_info = TRUE, ...) {
input = NULL, tag = NULL, container_name = NULL,
cache = TRUE, purge_info = TRUE,
build_args = NULL, run_args = NULL, ...) {

if (is.null(input))
stop('missing input file')
Expand Down Expand Up @@ -105,7 +107,8 @@ render_docker = function(
container_name)

docker_run_cmd_base = paste0(
"docker run --rm --name \"", container_name,
"docker run --rm ", run_args,
" --name \"", container_name,
"\" -u `id -u $USER` -v \"",
file_dir(dockerfile_path), ":", "/liftrroot/\" ",
image_name,
Expand Down
16 changes: 10 additions & 6 deletions man/render_docker.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7cdf2fd

Please sign in to comment.