write_docker.write_docker

write_docker.write_docker(
    app_file: str = 'app.py',
    path: str = './',
    rspm_env: bool = False,
    host: str = '0.0.0.0',
    port: str = '8080',
)

Writes a Dockerfile to run VetiverAPI in a container

Parameters

app_file : str = 'app.py'

File containing VetiverAPI to be deployed into container

path : str = './'

Path to save Dockerfile

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
tmp = tempfile.TemporaryDirectory()
board = pins.board_temp(allow_pickle_read=True)

X, y = vetiver.get_mock_data()
model = vetiver.get_mock_model().fit(X, y)
v = vetiver.VetiverModel(model, "my_model", prototype_data = X)

vetiver.vetiver_pin_write(board, v)
vetiver.write_app(board,
    "my_model",
    file = tmp.name + "/app.py")
vetiver.write_docker(app_file = "app.py", path = tmp.name)
Model Cards provide a framework for transparent, responsible reporting. 
 Use the vetiver `.qmd` Quarto template as a place to start, 
 with vetiver.model_card()
Writing pin:
Name: 'my_model'
Version: 20241216T204506Z-c176a