Learn R Programming

googleCloudRunner (version 0.2.0)

cr_buildstep_docker: Create a build step to build and push a docker image

Description

Create a build step to build and push a docker image

Usage

cr_buildstep_docker(
  image,
  tag = "$BUILD_ID",
  location = ".",
  projectId = cr_project_get(),
  dockerfile = "Dockerfile",
  ...
)

Arguments

image

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

tag

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

location

Where the Dockerfile to build is in relation to dir

projectId

The projectId

dockerfile

Specify the name of the Dockerfile found at location

...

Further arguments passed in to cr_buildstep

See Also

Other Cloud Buildsteps: cr_buildstep_bash(), cr_buildstep_decrypt(), cr_buildstep_df(), cr_buildstep_edit(), cr_buildstep_extract(), cr_buildstep_gitsetup(), cr_buildstep_mailgun(), cr_buildstep_nginx_setup(), cr_buildstep_pkgdown(), cr_buildstep_run(), cr_buildstep_r(), cr_buildstep_secret(), cr_buildstep_slack(), cr_buildstep()

Examples

Run this code
# NOT RUN {
cr_project_set("my-project")
cr_bucket_set("my-bucket")

cr_buildstep_docker("gcr.io/my-project/my-image")
cr_buildstep_docker("my-image")
cr_buildstep_docker("my-image", tag = "$BRANCH_NAME")

# setting up a build to trigger off a Git source:
my_image <- "gcr.io/my-project/my-image"
my_repo <- RepoSource("github_markedmondson1234_googlecloudrunner",
                      branchName="master")
# }
# NOT RUN {
docker_yaml <- cr_build_yaml(steps = cr_buildstep_docker(my_image))
built_docker <- cr_build(docker_yaml, source = my_repo)

# make a build trigger so it builds on each push to master
cr_buildtrigger("build-docker", trigger = my_repo, build = built_docker)
# }

Run the code above in your browser using DataLab