Explore your build options with buildpacks, Jib, or Docker

To run or debug an application on Kubernetes, you'll need to set your preference for how your container image is built by configuring it in the Develop on Kubernetes run configuration.

In a project that doesn't contain a skaffold.yaml file at the root or doesn't reference skaffold.yaml you can use the Cloud Code UI to choose a builder and build environment.

Building locally is free of charge since it uses your own resources. Building with Cloud Build is good for slower machines or machines that don't match the processor architecture of the target cluster. For information about the cost of building your application using Cloud Build, see Cloud Build Pricing.

Specify how your images are built

Cloud Code supports Docker, Jib, and Buildpacks artifact types.

Without a skaffold.yaml

When importing an existing application without a skaffold.yaml file or running an application that doesn't have a skaffold.yaml, you're prompted to specify settings when initializing.

If you're using one of the Cloud Code sample applications, to use the UI, delete the skaffold.yaml file before running a build action. For steps to choose a builder and build environment without the UI, see Manually creating a Skaffold configuration.

  1. In a project without a skaffold.yaml file, open the command palette (press Ctrl/Cmd+Shift+P or click View > Command Palette) and then run Cloud Code: Run on Kubernetes or Cloud Code: Debug on Kubernetes.
  2. In the Build environment section, choose a build environment.
  3. In the Deploy settings section, if you chose Cloud Build, specify the image registry you want Cloud Build to push images to.
  4. In the Build settings section, specify a builder (Docker, Jib, or buildpacks) for each image and its settings.
  5. Select or clear any of the configuration options and then click Debug or Run.

The options you choose are saved to a skaffold.yaml file that you can edit directly for further customization.

With an existing skaffold.yaml

For a project with an existing skaffold.yaml file, you need to manually edit your build options. Cloud Code provides snippets for common YAML schema viewable by pressing Command/Ctrl + Space. See the the Skaffold Build documentation for more details.

Use Skaffold profiles in Cloud Code

Cloud Code uses the Skaffold tool under the hood to power Cloud Code's build functionality. To configure Cloud Code for different build or deploy environments such as local or remote builds, Skaffold profiles are used

Create a new skaffold profile

If you'd like to define build, test and deployment configurations for different contexts, you can have different Skaffold profiles.

The following sample shows a profile named cloudbuild used to to build images with Cloud Build:

profiles:
# use the cloudbuild profile to build images using Google Cloud Build
- name: cloudbuild
   build:
   googleCloudBuild: {}
If you have multiple profiles, add the profile you want to use to your launch.json file. For more information on Skaffold profiles, see the Skaffold profiles documentation

What's next