prepare_docker
prepare_docker(
board,str,
pin_name: str = './',
path:
version,bool = False,
rspm_env: str = '0.0.0.0',
host: str = '8080',
port: )
Generate files needed for Docker
Deploying a vetiver model via Docker requires several files. This function will generate a Dockerfile, app.py
file, and a requirements.txt
to be usedto build and run a Docker container.
Parameters
board :
-
Pin board for model
pin_name : str
-
Name of pin
path : Path | str = './'
-
Path to output
version : str = None
-
Pin version to be used. If none is supplied, the most recent pin will be selected.
rspm_env : bool = False
-
Whether or not Posit Package Manager should be used
host : str = '0.0.0.0'
-
Host address to run VetiverAPI from Dockerfile
port : str = '8080'
-
Port to run VetiverAPI from Dockerfile
Examples
import vetiver
import tempfile
import pins
= tempfile.TemporaryDirectory()
tmp = pins.board_temp(allow_pickle_read=True)
board
= vetiver.get_mock_data()
X, y = vetiver.get_mock_model().fit(X, y)
model = vetiver.VetiverModel(model, "my_model", prototype_data = X)
v
vetiver.vetiver_pin_write(board, v)= board, pin_name = "my_model", path = tmp.name) vetiver.prepare_docker(board
Notes
This function uses vetiver.get_board_pkgs(board)
for generating requirements. For more complex use cases, call write_docker()
, load_pkgs()
, and write_app()
individually.