Posit Workbench image base:
ghcr.io/rstudio/r-session-complete-preview:jammy-daily
Build the custom project image:
docker build . -t ghcr.io/dbkegley/posit/image-classifier:jammy
docker push ghcr.io/dbkegley/posit/image-classifier:jammy
Add the image to Posit Connect:
curl -XPOST -H "Authorization: key ${CONNECT_API_KEY}" ${CONNECT_SERVER}/__api__/v1/environments \
--data '{
"title": "Custom image classifier",
"description": "My custom image classifier environment",
"cluster_name": "Kubernetes",
"name": "ghcr.io/dbkegley/posit/image-classifier:jammy",
"matching": "exact",
"r": {
"installations": [
{
"version": "4.2.3",
"path": "/opt/R/4.2.3/bin/R"
}
]
},
"python": {
"installations": [
{
"version": "3.9.14",
"path": "/opt/python/3.9.14/bin/python"
}
]
}
}'
On Posit Workbench, clone the project:
git clone https://github.com/sol-eng/python-examples
cd python-examples
git checkout 4e4be3f59f0fbcf3ccecc724a00b0da7a4ad6f07
git checkout -b image-classifier
Run the App on Posit Workbench and deploy the App to Posit Connect:
Note: The following deployment steps use
rsconnect::deployApp
to deploy the application to Posit Connect because push-button deployments do not support theimage
orenvManagement
arguments.
setwd("~/python-examples/reticulated-image-classifier")
# Run the app on Posit Workbench
shiny::runApp()
# Deploy the Application and tell Posit Connect to use the custom image
# when executing content. `envManagement=FALSE` tells Posit Connect not to
# install any additional R or Python packages during the deployment.
rsconnect::deployApp(image = 'ghcr.io/dbkegley/posit/image-classifier:jammy', envManagement = FALSE)