vetiver_write_docker | R Documentation |
After creating a Plumber file with vetiver_write_plumber()
, use
vetiver_write_docker()
to create a Dockerfile plus a vetiver_renv.lock
file for a pinned vetiver_model()
.
vetiver_write_docker(
vetiver_model,
plumber_file = "plumber.R",
path = ".",
...,
lockfile = "vetiver_renv.lock",
rspm = TRUE,
base_image = glue::glue("FROM rocker/r-ver:{getRversion()}"),
port = 8000,
expose = TRUE,
additional_pkgs = character(0)
)
vetiver_model |
A deployable |
plumber_file |
A path for your Plumber file, created via
|
path |
A path to write the Dockerfile and |
... |
Not currently used. |
lockfile |
The generated lockfile in |
rspm |
A logical to use the
RStudio Public Package Manager for
|
base_image |
The base Docker image to start with. Defaults to
|
port |
The server port for listening: a number such as 8080 or an
expression like |
expose |
Add |
additional_pkgs |
A character vector of additional package names to add
to the Docker image. For example, some boards like |
The content of the Dockerfile, invisibly.
library(pins)
tmp_plumber <- tempfile()
b <- board_temp(versioned = TRUE)
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
vetiver_write_plumber(b, "cars_linear", file = tmp_plumber)
## default port
vetiver_write_docker(v, tmp_plumber, tempdir())
## install more pkgs, like those required to access board
vetiver_write_docker(v, tmp_plumber, tempdir(),
additional_pkgs = required_pkgs(b))
## port from env variable
vetiver_write_docker(v, tmp_plumber, tempdir(),
port = 'as.numeric(Sys.getenv("PORT"))',
expose = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.