Tanzu Platform SaaS

Define application build defaults

Last Updated February 19, 2025

This topic tells you how to set application-specific default build configuration for your Kubernetes applications on Tanzu Platform.

Before you begin

Before you define application build defaults, you must have a ContainerApp for your application. Create a ContainerApp by running:

tanzu app init

Set the build path for your application

To set or change a reference to the root of your application’s source code, run:

tanzu app config build path set --app=APP-NAME FILE-PATH

Where:

  • FILE-PATH references the root of your application’s source code.
  • (Optional) APP-NAME references the ContainerApp name defined in tanzu app init. This argument defaults to the ContainerApp at the root of your current working directory if no app name is passed.

Set or delete build environment variables

  • To create non-secret build environment variables, run:

    tanzu app config build env-non-secret set --app=APP-NAME BP_JVM_VERSION=10
    
  • To remove non-secret build environment variables, run:

    tanzu app config build env-non-secret delete --app=APP-NAME BP_JVM_VERSION
    

Define the build type for your application

To set the default container image build solution for your application, Dockerfile or Buildpacks, run:

tanzu app config build type set --app=APP-NAME

For example:

$ tanzu app config build type set --app=my-app

? Select container build type to use for this app:  [Use arrows to move, type to filter]
> buildpacks
  dockerfile

If you choose dockerfile, you can override the default Dockerfile path and specify any Dockerfile stage by running:

tanzu app config build dockerfile set --app=APP-NAME

For example:

$ tanzu app config build dockerfile set --app=my-app

? Enter the path to the dockerfile:
? Stage to target within the dockerfile, or blank for none: