Cloud Native Buildpacks

Page last updated:

Cloud Native Buildpacks (CNBs) usually take your application source code and transform it into a container. If you are familiar with their concepts, there are some differences:

  • During build, instead of a container image, a droplet is produced. However, this should go unnoticed by the end user.
  • CNBs are not yet available as system buildpacks. Users always need to provide the list of buildpacks.
  • Using the new lifecycle property is currently only possible using a manifest.
  • Build- and run environment/image will be provided by the Cloud Foundry stack available on your platform (probably cflinuxfs4).
  • Using stacks provided by Paketo is not possible at the moment.
  • Software Bill of Material (SBOM) is missing operating system packages and is not directly accessible.

Push an app

While this sample is shipped with using Classic Buildpacks, it can be easily build with CNBs by replacing manifest.yaml:

---
applications:
- name: cf-nodejs
  lifecycle: cnb
  buildpacks:
  - docker://gcr.io/paketo-buildpacks/nodejs
  memory: 512M
  instances: 1
  random-route: true

Using the lifecycle property, the desired Buildpack variant can be selected. See the reference section for more details. In this example, the nodejs CNB container image is selected.

Private Cloud Native Buildpacks

You must use cf CLI v8.9.0 or later.

Cloud Native Buildpacks can be consumed from private registries, by using the CF_CNB_REGISTRY_CREDS environment variable, in two different ways: Username and password combination or a token:

export CF_CNB_REGISTRY_CREDS='{"<registry>": {"username":"<username>", "password":"<password>"}}'
export CF_CNB_REGISTRY_CREDS='{"<registry>": {"token":"<token>"}}'

Example:

---
applications:
- name: cf-nodejs
  lifecycle: cnb
  buildpacks:
  - docker://my-registry-a.corp/nodejs
  - docker://my-registry-b.corp/dynatrace
  memory: 512M
  instances: 1
  random-route: true
export CF_CNB_REGISTRY_CREDS='{"my-registry-a.corp": {"token":"aaaaaa"}, "my-registry-b.corp": {"token":"bbbbbb"}}'
cf push
Create a pull request or raise an issue on the source for this page in GitHub