This document specifies the interface between a lifecycle and a platform.
A platform orchestrates a lifecycle to make buildpack functionality available to end-users such as application developers.
Examples of a platform might include:
A “stack” refers to:
.
),A “stack version” refers to:
.
),A “launch layer” refers to a layer created from a <launch>/<layer>
directory as specified in the Buildpack Interface Specification.
An “app layer” refers to a layer created from the <app>
directory as specified in the Buildpack Interface Specification.
Stack authors SHOULD ensure that build image versions maintain ABI-compatibility with previous versions, although violating this requirement will not change the behavior of previously built images containing app and launch layers.
Stack authors MUST ensure that new run image versions maintain ABI-compatibility with previous versions. Stack authors MUST ensure that app and launch layers do not change behavior when the run image layers are upgraded to newer versions, unless those behavior changes are intended to fix security vulnerabilities.
The platform MUST execute the detection and build phases of the lifecycle on the build image.
The build image MUST ensure that:
User
field is set to a non-root user with a writable home directory.Env
field has the environment variable PACK_STACK_ID
set to the stack ID.Label
field has the label io.buildpacks.stack.id
set to the stack ID.To initiate the detection phase, the platform MUST invoke the /lifecycle/detector
executable with the user and environment defined in the build image config.
Invoking this executable with no flags is equivalent to the following invocation including all accepted flags and their default values.
/lifecycle/detector -buildpacks /buildpacks -order /buildpacks/order.toml -group ./group.toml -plan ./plan.toml
Where:
-buildpacks
MUST specify input from a buildpacks directory as defined in the Buildpacks Directory Layout section.-order
MUST specify input from an overriding order.toml
file path as defined in the Data Format section.-group
MUST specify output to a group.toml
file path as defined in the Data Format section.-plan
MUST specify output to a Build Plan as defined in the Buildpack Interface Specification.To initiate the build phase, the platform MUST invoke the /lifecycle/builder
executable with the user and environment defined in the build image config.
Invoking this executable with no flags is equivalent to the following invocation including all accepted flags and their default values.
/lifecycle/builder -buildpacks /buildpacks -group ./group.toml -plan ./plan.toml
Where:
-buildpacks
MUST specify input from a buildpacks directory as defined in the Buildpacks Directory Layout section.-group
MUST specify input from a group.toml
file path as defined in the Data Format section.-plan
MUST specify input from a Build Plan as defined in the Buildpack Interface Specification.The platform MUST provide the lifecycle with a reference to the run image during the export phase.
The run image MUST ensure that:
User
field is set to a user with the same UID and primary GID as in the build image.Label
field has the label io.buildpacks.stack.id
set to the stack ID.The buildpacks directory MUST contain unpackaged buildpacks such that:
latest
symbolic link, which MUST point to the latest buildpack version directory.Additionally, there MUST be an order.toml
file at the root containing a list of buildpacks groups to use during the detection phase.
The platform SHOULD run each phase of the lifecycle in an isolated container to prevent untrusted app and buildpack code from accessing storage credentials needed during the export and analysis phases. A more thorough explanation is provided in the Buildpack Interface Specification.
User-provided environment variables intended for build and launch SHOULD NOT come from the same list. The end-user SHOULD be encouraged to define them separately. The platform MAY determine the initial environment of the build phase, detection phase, and launch. The lifecycle MUST NOT assume that all platforms provide an identical environment.
Run image rebasing allows for fast stack updates for already-exported OCI images with minimal data transfer when those images are stored on a Docker registry. When a new stack version is available, the app layers and launch layers SHOULD be rebased on the new run image by updating the image’s configuration to point at the new run image. Once the new run image is present on the registry, no filesystem layers should be uploaded or downloaded.
Each platform SHOULD implement caching so as to appropriately optimize performance. Cache locality and availability MAY vary between platforms.
[[groups]]
labels = ["<label name>"]
buildpacks = [
{ id = "<buildpack ID>", version = "<buildpack version>", optional = <bool> }
]
Where:
Example:
[[groups]]
labels = ["custom-dotnet"]
buildpacks = [
{ id = "io.buildpacks.nodejs", version = “latest”, optional = true },
{ id = "io.buildpacks.dotnet-core", version = “latest” }
]
[[groups]]
labels = ["custom-ruby", "ruby"]
buildpacks = [
{ id = "io.buildpacks.nodejs", version = “latest”, optional = true },
{ id = "io.buildpacks.ruby", version = “latest” }
]
[[groups]]
labels = ["ruby-datascience", "ruby"]
buildpacks = [
{ id = "io.buildpacks.python", version = “latest” },
{ id = "io.buildpacks.ruby", version = “latest” }
]
buildpacks = [
{ id = "<buildpack ID>", version = "<buildpack version>" }
]
Where: