cr_deploy_docker {googleCloudRunner}R Documentation

Deploy a local Dockerfile to be built on ContainerRegistry

Description

Build a local Dockerfile in the cloud. See googleCloudRunner website for help how to generate Dockerfiles. If you want the docker to build on each commit, see also cr_deploy_docker_trigger

Usage

cr_deploy_docker(
  local,
  image_name = remote,
  dockerfile = NULL,
  remote = basename(local),
  tag = c("latest", "$BUILD_ID"),
  timeout = 600L,
  bucket = cr_bucket_get(),
  projectId = cr_project_get(),
  launch_browser = interactive(),
  kaniko_cache = TRUE,
  predefinedAcl = "bucketOwnerFullControl",
  pre_steps = NULL,
  post_steps = NULL,
  ...
)

cr_deploy_docker_construct(
  local,
  image_name = remote,
  dockerfile = NULL,
  remote = basename(local),
  tag = c("latest", "$BUILD_ID"),
  timeout = 600L,
  bucket = cr_bucket_get(),
  projectId = cr_project_get(),
  launch_browser = interactive(),
  kaniko_cache = TRUE,
  predefinedAcl = "bucketOwnerFullControl",
  pre_steps = NULL,
  post_steps = NULL,
  ...
)

Arguments

local

The folder containing the Dockerfile to build

image_name

The name of the docker image to be built either full name starting with gcr.io or constructed from the image_name and projectId via gcr.io/{projectId}/{image_name}

dockerfile

An optional Dockerfile built to support the script. Not needed if "Dockerfile" exists in folder. If supplied will be copied into deployment folder and called "Dockerfile"

remote

The folder on Google Cloud Storage

tag

The tag or tags to be attached to the pushed image - can use Build macros

timeout

Amount of time that this build should be allowed to run, to second

bucket

The GCS bucket that will be used to deploy code source

projectId

The projectId

launch_browser

Whether to launch the logs URL in a browser once deployed

kaniko_cache

If TRUE will use kaniko cache for Docker builds.

predefinedAcl

Access setting for the bucket used in deployed. Set to "bucketLevel" if using bucket level access

pre_steps

Other cr_buildstep to run before the docker build

post_steps

Other cr_buildstep to run after the docker build

...

Arguments passed on to cr_buildstep_docker

image

The image tag that will be pushed, starting with gcr.io or created by combining with projectId if not starting with gcr.io

location

Where the Dockerfile to build is in relation to dir

build_args

additional arguments to pass to docker build, should be a character vector.

push_image

if kaniko_cache = FALSE and push_image = FALSE, then the docker image is simply built and not pushed

Details

This lets you deploy local folders with Dockerfiles, automating saving the source on Google Cloud Storage.

To deploy builds on git triggers and sources such as GitHub, see the examples of cr_buildstep_docker or the use cases on the website

Note

'cr_deploy_docker_construct' is a helper function to construct the arguments needed to deploy the docker, which may be combined with cr_deploy_r to combine Docker and R

See Also

If you want the docker to build on each commit, see cr_deploy_docker_trigger

Other Deployment functions: cr_deploy_docker_trigger(), cr_deploy_packagetests(), cr_deploy_pkgdown(), cr_deploy_run_website(), cr_deploy_run(), cr_deploy_r()

Examples

## Not run: 
cr_project_set("my-project")
cr_region_set("europe-west1")
cr_email_set("123456@projectid.iam.gserviceaccount.com")
cr_bucket_set("my-bucket")

b <- cr_deploy_docker(system.file("example/", package = "googleCloudRunner"))

## End(Not run)

[Package googleCloudRunner version 0.5.0 Index]