drender.Rd 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/drender.R
  3. \name{drender}
  4. \alias{drender}
  5. \title{Render Dockerized R Markdown Documents}
  6. \usage{
  7. drender(input = NULL, tag = NULL, build_args = NULL,
  8. container_name = NULL, reset = FALSE, clean = FALSE, cache = TRUE,
  9. rm = FALSE, prebuild = NULL, port = 80, browseURL = FALSE,
  10. privileged = TRUE, dind = TRUE, ...)
  11. }
  12. \arguments{
  13. \item{input}{Input file to render in Docker container.}
  14. \item{tag}{Docker image name to build, sent as docker argument \code{-t}.
  15. If not specified, it will use the same name as the input file.}
  16. \item{build_args}{A character string specifying additional
  17. \code{docker build} arguments. For example,
  18. \code{--pull=true -m="1024m" --memory-swap="-1"}.}
  19. \item{container_name}{Docker container name to run.
  20. If not specified, we will generate and use a random name.}
  21. \item{reset}{Should we cleanup the Docker container and
  22. Docker image after getting the rendered result?}
  23. \item{clean}{default FALSE, if TRUE, clean all containers before build.}
  24. \item{cache}{default TRUE, if FALSE, build with --no-cache=true}
  25. \item{rm}{default FALSE, if TRUE build with --rm}
  26. \item{prebuild}{a command line string to call before docker build}
  27. \item{port}{default 80 map to shiny's 3838 service}
  28. \item{browseURL}{FALSE, if TRUE open shiny app in the browser.}
  29. \item{privileged}{TRUE, with '--privileged=true'}
  30. \item{dind}{TRUE run with " -v /var/run/docker.sock:/var/run/docker.sock"}
  31. \item{...}{Additional arguments passed to
  32. \code{\link[rmarkdown]{render}}.}
  33. }
  34. \value{
  35. Rendered file is written to the same directory of the input file.
  36. A character vector with the image name and container name will be
  37. returned. You will be able to manage them with \code{docker}
  38. commands later if \code{reset = FALSE}.
  39. }
  40. \description{
  41. Render dockerized R Markdown documents using Docker containers.
  42. Rabix tools/workflows will be ran if there is a \code{Rabixfile}
  43. generated by \link{lift} under the same directory.
  44. }
  45. \details{
  46. Before using \code{drender()}, run \link{lift} on the document
  47. first to generate \code{Dockerfile}.
  48. See \code{vignette('liftr-intro')} for details about the extended
  49. YAML front-matter metadata format and system requirements for
  50. rendering dockerized R Markdown documents.
  51. }
  52. \examples{
  53. # 1. Dockerized R Markdown document
  54. # Docker is required to run the example,
  55. # so make sure we can use `docker` in shell.
  56. dir_docker = paste0(tempdir(), '/drender_docker/')
  57. dir.create(dir_docker)
  58. file.copy(system.file("examples/docker.Rmd", package = "liftr"), dir_docker)
  59. docker_input = paste0(dir_docker, "docker.Rmd")
  60. lift(docker_input)
  61. \dontrun{
  62. drender(docker_input)
  63. # view rendered document
  64. browseURL(paste0(dir_docker, "docker.html"))}
  65. # 2. Dockerized R Markdown document with Rabix options
  66. # Docker and Rabix are required to run the example,
  67. # so make sure we can use `docker` and `rabix` in shell.
  68. dir_rabix = paste0(tempdir(), '/drender_rabix/')
  69. dir.create(dir_rabix)
  70. file.copy(system.file("template/rabix.Rmd", package = "liftr"), dir_rabix)
  71. rabix_input = paste0(dir_rabix, "rabix.Rmd")
  72. lift(rabix_input)
  73. \dontrun{
  74. drender(rabix_input)
  75. # view rendered document
  76. browseURL(paste0(dir_rabix, "rabix.html"))}
  77. }