
Generate files necessary to build a Docker container for a vetiver model
Source:R/write-docker.R
vetiver_prepare_docker.Rd
Deploying a vetiver model via Docker requires several files. Use this
function to create these needed files in the directory located at path
.
Arguments
- board
A pin board, created by
board_folder()
,board_connect()
,board_url()
or anotherboard_
function.- name
Pin name.
- version
Retrieve a specific version of a pin. Use
pin_versions()
to find out which versions are available and when they were created.- path
A path to write the Plumber file, Dockerfile, and lockfile, capturing the model's dependencies. Defaults to the working directory.
- predict_args
A list of optional arguments passed to
vetiver_api()
such as the endpointpath
or predictiontype
.- docker_args
A list of optional arguments passed to
vetiver_write_docker()
such as thelockfile
name or whether to userspm
. Do not passadditional_pkgs
here, as this function usesadditional_pkgs = required_pkgs(board)
.
Details
The function vetiver_prepare_docker()
uses:
vetiver_write_plumber()
to create a Plumber file andvetiver_write_docker()
to create a Dockerfile and renv lockfile
These modular functions are available for more advanced use cases.
Examples
library(pins)
b <- board_temp(versioned = TRUE)
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
#> Creating new version '20230126T205929Z-5a3c6'
#> Writing to pin 'cars_linear'
vetiver_prepare_docker(b, "cars_linear", path = tempdir())
#> The version of R recorded in the lockfile will be updated:
#> - R [* -> 4.2.2]
#>
#> * Lockfile written to 'vetiver_renv.lock'.