diff --git a/categories/index.html b/categories/index.html index 737121312..dd1230095 100644 --- a/categories/index.html +++ b/categories/index.html @@ -299,6 +299,14 @@
A buildpack
is software that examines your source code and determines the best way to build it.
A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
Buildpacks allow application developers to focus on what they do best - writing code, without having to worry about image security, optimizing container images, or container build strategy.
+How much time have you spent struggling to wrangle yet another Dockerfile? Copying and pasting random Dockerfile snippets into every project? Buildpacks can help! They are a better approach to building container images for applications.
+Typical buildpacks consist of at least three files:
+buildpack.toml
– provides metadata about the buildpack, containing information such as its name, ID, and version.bin/detect
– performs detect.bin/build
– performs build.Each buildpack has two phases
-The detect
phase runs against your source code to determine if the buildpack is applicable or not.
-Once a buildpack is detected
to be applicable, it proceeds to the build
stage. If the project fails detection
the build
stage for a specific buildpack is skipped.
Each buildpack has two jobs to do
+The buildpack determines if it is needed or not.
For example:
requirements.txt
or a setup.py
file passpackage-lock.json
file to passrequirements.txt
or a setup.py
file.package-lock.json
file.The build
phase runs against your source code to -
The buildpack transforms application source code in some way, for example by
For example:
pip install -r requirements.txt
if it detected a requirements.txt
filenpm install
if it detected a package-lock.json
filepip install -r requirements.txt
if it detected a requirements.txt
file.npm install
if it detected a package-lock.json
file.A buildpack
is software that examines your source code and determines the best way to build it.
A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
A buildpack group is a list of individual buildpacks that are designged to work together to build an application.
Buildpack groups allow you to connect multiple modular buildpacks together, making buildpacks modular and re-usable.
For example, you might have a buildpack that installs Java and a buildpack that uses Maven to build your application. These two buildpacks can be combined into a group to implement higher-level functionality, specifically that the first one will install Java and the second will use Java to run Maven, which is a Java build tool.
-Because you can have many buildpack groups in a builder or meta-buildpack and you can reuse buildpacks, you could have a second buildpack group that reuses the buildpack to provide Java but uses a third buildpack that provides Gradle to build your application. By doing this, you can create additional high-level functionality without having duplication.
+Because you can have many buildpack groups in a builder or meta-buildpack and you can reuse buildpacks, you could have a second buildpack group that reuses the buildpack to provide Java but uses a third buildpack that provides Gradle to build your application. By doing this, you can create additional high-level functionality without having duplication.
A buildpack group is a list of buildpack entries defined in the order in which they will run.
A buildpack entry is identified by an id and a version. It may also be marked as optional. While you may have one or more buildpacks in a buildpack group, you may have one or more buildpack groups in a builder or meta-buildpack.
A builder or meta-buildpack may contain multiple buildpack groups. When the lifecycle executes the detection process, it will process each buildpack group it finds in the order that the groups are specified. For each buildpack group, the lifecycle will execute the detect phase of all buildpacks in that group (these can be executed in parallel) and aggregate the results. The lifecycle will select the first buildpack group by order where all of the non-optional buildpacks in that group pass detection.
+A builder or meta-buildpack may contain multiple buildpack groups. When the lifecycle executes the detection process, it will process each buildpack group it finds in the order that the groups are specified. For each buildpack group, the lifecycle will execute the detect phase of all buildpacks in that group (these can be executed in parallel) and aggregate the results. The lifecycle will select the first buildpack group by order where all of the non-optional buildpacks in that group pass detection.
For example, if a builder has buildpack groups A, B and C. The lifecycle will run detection against A. If all of the non-optional buildpacks in that group pass detection, then it will select A. In that case, B and C will not be processed. If A has any failing non-optional buildpacks, then the lifecycle will move on to process buildpack group B. If B has any failing non-optional buildpacks, then the lifecycle will move on to process buildpack group C. If C fails, then the entire detection process will fail.
If a buildpack group contains meta-buildpacks, which in turn may contain more buildpack groups those are expanded using the order resolution rules such that each buildpack group in the meta-buildpack is tried with the other buildpacks in the containing buildpack group.
For example:
diff --git a/docs/for-buildpack-authors/concepts/buildpack/index.html b/docs/for-buildpack-authors/concepts/buildpack/index.html new file mode 100644 index 000000000..67af2336a --- /dev/null +++ b/docs/for-buildpack-authors/concepts/buildpack/index.html @@ -0,0 +1,984 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
Buildpacks allow application developers to focus on what they do best - writing code, without having to worry about image security, optimizing container images, or container build strategy.
+How much time have you spent struggling to wrangle yet another Dockerfile? Copying and pasting random Dockerfile snippets into every project? Buildpacks can help! They are a better approach to building container images for applications.
+Typical buildpacks consist of at least three files:
+buildpack.toml
– provides metadata about the buildpack, containing information such as its name, ID, and version.bin/detect
– performs detect.bin/build
– performs build.Each buildpack has two jobs to do
+The buildpack determines if it is needed or not.
+For example:
+requirements.txt
or a setup.py
file.package-lock.json
file.The buildpack transforms application source code in some way, for example by
+For example:
+pip install -r requirements.txt
if it detected a requirements.txt
file.npm install
if it detected a package-lock.json
file.build
layers – the directory will be accessible by subsequent buildpacks,cache
layers – the directory will be included in the cache,launch
layers – the directory will be included in the run image as a single layer,launch
layers – the directory will be included in the final app image as a single layer,In this section we look at caching each layer type.
A composite buildpack, also sometimes called a “meta-buildpack”,
+is a buildpack that does not contain any ./bin/detect
or ./bin/build
binaries,
+but instead references other buildpacks in its buildpack.toml
via the [[order]]
array.
This is useful for composing more complex detection strategies.
+ + + + +An image extension
is software that generates Dockerfiles that can be used to extend base images for buildpacks builds.
Buildpacks can do a lot, but there are some things buildpacks can’t do. They can’t install operating system packages, +for example. Why not?
+Buildpacks do not run as the root
user and cannot make arbitrary changes to the filesystem. This enhances security,
+enables buildpack interoperability, and preserves the ability to rebase - but it comes at a cost. Base image authors
+must anticipate the OS-level dependencies that will be needed at build and run-time ahead of time, and this isn’t always
+possible.
This has been a longstanding source of discussion within the CNB project: +how can we preserve the benefits of buildpacks while enabling more powerful capabilities?
+Buildpacks are often presented as an alternative to Dockerfiles, but we think buildpacks and Dockerfiles can work +together.
+Buildpacks are optimized for creating layers that are efficient and logically mapped to the dependencies that they +provide. By contrast, Dockerfiles are the most-used and best-understood mechanism for constructing base images and +installing OS-level dependencies for containers.
+The CNB Dockerfiles feature allows Dockerfiles to “provide” dependencies that buildpacks “require” through a +shared build plan, by introducing the concept of image extensions.
+Image extensions are buildpack-like components that use a restricted Dockerfile
syntax to expand base images. Their
+purpose is to generate Dockerfiles that can be used to extend the builder or run images prior to buildpacks builds.
An image extension could be defined with the following directory:
+.
+├── extension.toml <- similar to a buildpack buildpack.toml
+├── bin
+│ ├── detect <- similar to a buildpack ./bin/detect
+│ ├── generate <- similar to a buildpack ./bin/build
+
extension.toml
provides metadata about the extension, containing information such as its name, ID, and version../bin/detect
performs detect. It analyzes application source code to determine if the extension
+is needed and contributes build plan entries../bin/generate
performs generate (a new lifecycle phase that happens after detect
). It
+outputs either or both of build.Dockerfile
or run.Dockerfile
for extending the builder or run image.Each image extension has two jobs to do
+The extension determines if it is needed or not.
+Like buildpacks, extensions participate in the detect
phase - analyzing application source code to determine if they
+are needed. During detect
, extensions can contribute to
+the build plan - recording dependencies that they are able to "
+provide" (though unlike buildpacks, they can’t “require” anything).
If the provided order contains extensions, the output of detect
will be a group of image extensions and a group of
+buildpacks that together produce a valid build plan. Image extensions only generate Dockerfiles - they don’t create
+layers or participate in the build
phase.
The extension outputs Dockerfiles that can be used to extend either or both of the build-time base image and the runtime base image.
+For more information and to see a build in action, +see authoring an image extension.
+ + + +A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
The lifecycle is a binary responsible for orchestrating buildpacks.
@@ -913,6 +943,23 @@A composite buildpack, also sometimes called a “meta-buildpack”, is a buildpack that does not contain any ./bin/detect or ./bin/build binaries, but instead references other buildpacks in its buildpack.toml via the [[order]] array. +This is useful for composing more complex detection strategies.
+ + +An image extension
is software that generates Dockerfiles that can be used to extend base images for buildpacks builds.
This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon. If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
diff --git a/docs/for-buildpack-authors/concepts/index.xml b/docs/for-buildpack-authors/concepts/index.xml index 614c07a64..e20551cc4 100644 --- a/docs/for-buildpack-authors/concepts/index.xml +++ b/docs/for-buildpack-authors/concepts/index.xml @@ -7,6 +7,13 @@This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon.
+If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
+ + + +Learn how to publish your buildpack to the Buildpack Registry.
+Learn how to package your buildpack or extension for distribution.
-Learn how to package your buildpack or extension for distribution.
+Learn how to publish your buildpack to the Buildpack Registry.
This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon. +If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
+ + +For further details, see the platform migration guide.
For older platforms (Platform API version 0.9 and below), arguments in command
will be prepended to arguments in args
, negating the new functionality (but preserving compatibility).
Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see here for more information).
+Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see here for more information).
For more information, see our tutorial on authoring an image extension.
diff --git a/docs/for-buildpack-authors/how-to/migrate/buildpack-api-0.9-0.10/index.html b/docs/for-buildpack-authors/how-to/migrate/buildpack-api-0.9-0.10/index.html index 3f74f1cd1..016761654 100644 --- a/docs/for-buildpack-authors/how-to/migrate/buildpack-api-0.9-0.10/index.html +++ b/docs/for-buildpack-authors/how-to/migrate/buildpack-api-0.9-0.10/index.html @@ -303,6 +303,14 @@This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon.
-If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
+Each directory created by the buildpack under the CNB_LAYERS_DIR
can be used as a layer in the final app image or build cache.
That is, each directory can be used for any of the following purposes:
+Layer Type | ++ |
---|---|
Launch |
+the directory will be included in the final app image as a single layer | +
Cache |
+the directory will be included in the build cache and restored to the CNB_LAYERS_DIR on future builds |
+
Build |
+the directory will be accessible to buildpacks that follow in the build (via the environment) | +
A buildpack can control how a layer will be used by creating a <layer>.toml
with a name matching the directory it describes in the CNB_LAYERS_DIR
.
A buildpack might create a $CNB_LAYERS_DIR/python
directory and a $CNB_LAYERS_DIR/python.toml
with the following contents:
launch = true
+cache = true
+build = true
+
In this example:
+python
, as this is needed to run the app$CNB_LAYERS_DIR/python
directory will be pre-created for future builds, avoiding the need to re-download this large dependencypython
This is a simple ./bin/build
script for a buildpack that runs Python’s pip
package manager to resolve dependencies:
#!/bin/sh
+
+PIP_LAYER="$CNB_LAYERS_DIR/pip"
+mkdir -p "$PIP_LAYER/modules" "$PIP_LAYER/env"
+
+pip install -r requirements.txt -t "$PIP_LAYER/modules" \
+ --install-option="--install-scripts=$PIP_LAYER/bin" \
+ --exists-action=w --disable-pip-version-check --no-cache-dir
+
+echo "launch = true" > "$PIP_LAYER.toml"
+
diff --git a/docs/for-buildpack-authors/how-to/write-buildpacks/create-slice-layers/index.html b/docs/for-buildpack-authors/how-to/write-buildpacks/create-slice-layers/index.html
index 76995ad38..78bb70bab 100644
--- a/docs/for-buildpack-authors/how-to/write-buildpacks/create-slice-layers/index.html
+++ b/docs/for-buildpack-authors/how-to/write-buildpacks/create-slice-layers/index.html
@@ -301,6 +301,14 @@
To write a buildpack, we follow the Buildpack Specification, +which defines the contract between buildpacks and the lifecycle.
+A buildpack must contain three files:
+buildpack.toml
bin/detect
bin/build
The two files in bin/
must be executable.
+They can be shell scripts written in a language like Bash,
+or they can be executables compiled from a language like Go.
buildpack.toml
A buildpack must contain a buildpack.toml
file in its root directory.
api = "0.10"
+
+[buildpack]
+id = "example.com/python"
+version = "1.0"
+
+# Targets the buildpack will work with
+[[targets]]
+os = "linux"
+
+# Stacks (deprecated) the buildpack will work with
+[[stacks]]
+id = "io.buildpacks.stacks.jammy"
+
For more information, see buildpack config.
+bin/detect
bin/detect
+
bin/detect
is used to determine if a buildpack can work with a given codebase.
+It will often check for the existence of a particular file,
+or some configuration indicating what kind of application has been provided.
Two environment variables identify important file system paths:
+CNB_PLATFORM_DIR
- a directory containing platform provided configuration, such as environment variables.CNB_BUILD_PLAN_PATH
- a path to a file containing the build plan.In addition, the working directory for bin/detect
is the application directory.
bin/detect
must return an exit code of 0
if the codebase can be serviced by this buildpack,
+and 100
if it cannot.
+Other exit codes indicate an error during detection.
This is a simple example of a buildpack that detects a Python application
+by checking for the presence of a requirements.txt
file:
#!/bin/sh
+
+if [ -f requirements.txt ]; then
+ echo "Python Buildpack"
+ exit 0
+else
+ exit 100
+fi
+
bin/build
bin/build
+
bin/build
does (all or part of) the work of transforming application source code into a runnable artifact.
+It will often resolve dependencies, install binary packages, and compile code.
+Three environment variables identify important file system paths:
CNB_LAYERS_DIR
- a directory that may contain subdirectories representing each layer created by the buildpack in the final image or build cache.CNB_PLATFORM_DIR
- a directory containing platform provided configuration, such as environment variables.CNB_BP_PLAN_PATH
- a path to a file containing the build plan.In addition, the working directory for bin/build
is the application directory.
All changes to the codebase in the working directory will be persisted in the final image,
+along with any launch layers created in the CNB_LAYERS_DIR
.
It is important to note that multiple buildpacks may work together to create the final image, +each contributing a subset of the dependencies or configuration needed to run the application. +In this way, buildpacks are modular and composable.
+ + + +To write a buildpack, we follow the Buildpack Specification, +which defines the contract between buildpacks and the lifecycle.
+ + +The Build Plan is a document that buildpacks can use to pass information between the detect
and build
phases, and between each other.
+The build plan is passed (by the lifecycle) as a parameter to the detect
and build
binaries of each buildpack.
Each directory created by the buildpack under the CNB_LAYERS_DIR
can be used as a layer in the final app image or build cache.
One of the benefits of buildpacks is that they are multi-process - an image can have multiple entrypoints for each operational mode.
@@ -889,15 +936,6 @@This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon. -If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
- - -This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon. If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
@@ -935,15 +973,6 @@This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon. -If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
- - -This page is a stub! The CNB project is applying to Google Season of Docs to receive support for improving our documentation. Please check back soon.
-If you are familiar with this content and would like to make a contribution, please feel free to open a PR :)
+The Build Plan is a document that buildpacks can use to pass information between the detect
and build
phases, and between each other.
+The build plan is passed (by the lifecycle) as a parameter to the detect
and build
binaries of each buildpack.
During the detect
phase, each buildpack may write something it requires
or provides
(or both) into the Build Plan.
+A buildpack can require
or provide
multiple dependencies, and even multiple groupings of dependencies (using or
lists).
+Additionally, multiple buildpacks may require
or provide
the same dependency.
+For detailed information, consult the spec.
The lifecycle uses the Build Plan to determine whether a particular list of buildpacks can work together, +by seeing whether all dependencies required can be provided by that list.
+Later, during the build
phase, each buildpack may read the Buildpack Plan (a condensed version of the Build Plan, composed by the lifecycle) to determine what it should do.
Let’s see how this works with an example.
+node-engine
buildpackLet’s walk through some possible cases a node-engine
buildpack may consider:
We will also consider what an NPM
and a JVM
buildpack may do.
A node-engine
buildpack is always happy to provide
the node
dependency. The build plan it will write may look something like:
[[provides]]
+name = "node"
+
++NOTE: If this was the only buildpack running, this would fail the
+detect
phase. In order to pass, everyprovides
must be matched up with arequires
, whether in the same buildpack or in another buildpack. +See the spec for particulars on how ordering buildpacks can adjust detection results.
During the detect
phase, the node-engine
buildpack sees in one configuration file (e.g. a .nvmrc
file in the app directory) that node v10.x
is explicitly requested by the application. Seeing that, it may write the below text to the build plan:
[[provides]]
+name = "node"
+
+[[requires]]
+name = "node"
+version = "10.x"
+
+[requires.metadata]
+version-source = ".nvmrc"
+
As always, the buildpack provides
node
. In this particular case, a version of node
(10.x
) is being requested in a configuration file (.nvmrc
). The buildpack chooses to add an additional piece of metadata (version-source
), so that it can understand where that request came from.
NPM
is the default package manager for node
. A NPM Buildpack may ensure that all the packages for the application are present (by running npm install
), and perhaps cache those packages as well, to optimize future builds.
NPM is typically distributed together with node. As a result, a NPM buildpack may require node
, but not want to provide
it, trusting that the node-engine
buildpack will be in charge of providing
node
.
The NPM buildpack could write the following to the build plan, if the buildpack sees that npm
is necessary (e.g., it sees a package.json
file in the app directory):
[[requires]]
+name = "node"
+
If, looking in the package.json
file, the NPM buildpack sees a specific version of node
requested in the engines field (e.g. 14.1
), it may write the following to the build plan:
[[requires]]
+name = "node"
+version = "14.1"
+
+[requires.metadata]
+version-source = "package.json"
+
++NOTE: As above, if this was the only buildpack running, this would fail the
+detect
phase. In order to pass, everyprovides
must be matched up with arequires
, whether in the same buildpack or in another buildpack. +See the spec for particulars on how ordering buildpacks can adjust detection results.
However, if the NPM Buildpack was run together with the Node Engine buildpack (which provides
node
), the lifecycle will see that all requirements are fulfilled, and select that group as the correct set of buildpacks.
Java is distributed in two formats - the jdk
(Java Development Kit), which allows for compilation and running of Java programs, and the jre
(Java Runtime Environment, which allows for running compiled Java programs).
+A very naive implementation of the buildpack may have it write several provides
options to the build plan, detailing everything that it can provide,
+while later buildpacks would figure out based on the application which options it requires, and would require
those.
+In this particular case, we can use the or
operator to present different possible build plans the buildpack can follow:
# option 1 (`jre` and `jdk`)
+[[provides]]
+name = "jre"
+
+[[provides]]
+name = "jdk"
+
+# option 2 (or just `jdk`)
+[[or]]
+[[or.provides]]
+name = "jdk"
+
+# option 3 (or just `jre`)
+[[or]]
+[[or.provides]]
+name = "jre"
+
The buildpack gives three options to the lifecycle:
+jre
jdk
jdk
and jre
As with the other buildpacks, this alone will not be sufficient for the lifecycle. However, other buildpacks that follow may require
certain things.
For example, another buildpack may look into the application and, seeing that it is a Java executable, require
the jre
in order to run it.
+When the lifecycle analyzes the results of the detect
phase, it will see that there is a buildpack which provides jre
, and a buildpack that requires jre
,
+and will therefore conclude that those options represent a valid set of buildpacks.
By doing this, you’ll learn how to create arbitrary layers with your buildpack, and how to read the contents of the app in order to perform actions like downloading dependencies.
Let’s begin by changing the node-js-buildpack/bin/build
so that it creates a layer for NodeJS.
A Buildpack layer is represented by a directory inside the layers directory provided to our buildpack by the Buildpack execution environment. As defined by the buildpack specification, the layers directory is always passed to the build
script as the first positional parameter. To create a new layer directory representing the NodeJS runtime, change the build
script to look like the following. The variable CNB_LAYERS_DIR
is provided to the build script as defined by the buildpacks specification.
A Buildpack layer is represented by a directory inside the layers directory provided to our buildpack by the Buildpack execution environment. As defined by the buildpack specification, the layers directory is always passed to the build
script as the first positional parameter. To create a new layer directory representing the NodeJS runtime, change the build
script to look like the following. The variable CNB_LAYERS_DIR
is provided to the build script as defined by the buildpacks specification.
#!/usr/bin/env bash
set -eo pipefail
@@ -869,7 +890,7 @@ Creating a Layer
node_js_layer="${CNB_LAYERS_DIR}"/node-js
mkdir -p "${node_js_layer}"
-
The node_js_layer
directory is a sub-directory of the directory provided as the first positional argument to the build script (the layers directory), and this is where we’ll store the NodeJS runtime.
The node_js_layer
directory is a sub-directory of the directory provided as the first positional argument to the build script (the layers directory), and this is where we’ll store the NodeJS runtime.
Next, we’ll download the NodeJS runtime and install it into the layer directory. Add the following code to the end of the build
script:
echo "---> Downloading and extracting NodeJS"
diff --git a/docs/for-buildpack-authors/tutorials/basic-buildpack/05_make-app-runnable/index.html b/docs/for-buildpack-authors/tutorials/basic-buildpack/05_make-app-runnable/index.html
index 8b415dc71..e26b4489a 100644
--- a/docs/for-buildpack-authors/tutorials/basic-buildpack/05_make-app-runnable/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-buildpack/05_make-app-runnable/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+-
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-buildpack/06_caching/index.html b/docs/for-buildpack-authors/tutorials/basic-buildpack/06_caching/index.html
index 6209d8835..78546c645 100644
--- a/docs/for-buildpack-authors/tutorials/basic-buildpack/06_caching/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-buildpack/06_caching/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-buildpack/07_make-buildpack-configurable/index.html b/docs/for-buildpack-authors/tutorials/basic-buildpack/07_make-buildpack-configurable/index.html
index 941ab07c2..9378d2ed5 100644
--- a/docs/for-buildpack-authors/tutorials/basic-buildpack/07_make-buildpack-configurable/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-buildpack/07_make-buildpack-configurable/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-buildpack/index.html b/docs/for-buildpack-authors/tutorials/basic-buildpack/index.html
index 2880919f0..a6b4ae243 100644
--- a/docs/for-buildpack-authors/tutorials/basic-buildpack/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-buildpack/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/01_setup-local-environment/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/01_setup-local-environment/index.html
index 98746a9ca..520697e40 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/01_setup-local-environment/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/01_setup-local-environment/index.html
@@ -299,6 +299,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -673,6 +676,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -694,6 +700,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -705,6 +717,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -717,9 +738,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -731,9 +749,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -756,6 +771,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -794,14 +812,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/02_why-dockerfiles/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/02_why-dockerfiles/index.html
index d6a6ce862..13bbeb76d 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/02_why-dockerfiles/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/02_why-dockerfiles/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/03_building-blocks-extension/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/03_building-blocks-extension/index.html
index 377fc671e..edd6faebc 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/03_building-blocks-extension/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/03_building-blocks-extension/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
@@ -867,7 +888,7 @@ Examine vim
extension
API except where noted. Consult the spec
for further details.
./bin/detect
is invoked during the detect
phase. It analyzes application source code to determine if the extension
-is needed and contributes build plan entries (much like a
+is needed and contributes build plan entries (much like a
buildpack ./bin/detect
). Just like for buildpacks, a ./bin/detect
that exits with code 0
is considered to have
passed detection, and fails otherwise.
./bin/generate
is invoked during the generate
phase (a new lifecycle phase that happens after detect
). It
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/04_build-dockerfile/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/04_build-dockerfile/index.html
index 15729e8fe..5667fd717 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/04_build-dockerfile/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/04_build-dockerfile/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+-
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/05_run-dockerfile-switch/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/05_run-dockerfile-switch/index.html
index 9fe9d3b28..380e40db5 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/05_run-dockerfile-switch/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/05_run-dockerfile-switch/index.html
@@ -299,6 +299,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -673,6 +676,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -694,6 +700,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -705,6 +717,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -717,9 +738,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -731,9 +749,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -756,6 +771,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -794,14 +812,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/06_run-dockerfile-extend/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/06_run-dockerfile-extend/index.html
index c7d815732..ec45b1598 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/06_run-dockerfile-extend/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/06_run-dockerfile-extend/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/basic-extension/index.html b/docs/for-buildpack-authors/tutorials/basic-extension/index.html
index 5d2953d9f..83f15814a 100644
--- a/docs/for-buildpack-authors/tutorials/basic-extension/index.html
+++ b/docs/for-buildpack-authors/tutorials/basic-extension/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-buildpack-authors/tutorials/index.html b/docs/for-buildpack-authors/tutorials/index.html
index b97941e02..d8aac388d 100644
--- a/docs/for-buildpack-authors/tutorials/index.html
+++ b/docs/for-buildpack-authors/tutorials/index.html
@@ -299,6 +299,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -673,6 +676,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -694,6 +700,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -705,6 +717,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -717,9 +738,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -731,9 +749,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -756,6 +771,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -794,14 +812,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-platform-operators/concepts/builder/index.html b/docs/for-platform-operators/concepts/builder/index.html
index c956ea4ff..f4820e3ef 100644
--- a/docs/for-platform-operators/concepts/builder/index.html
+++ b/docs/for-platform-operators/concepts/builder/index.html
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
-
-
+ -
+ What is a composite buildpack?
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
diff --git a/docs/for-platform-operators/concepts/buildpack/index.html b/docs/for-platform-operators/concepts/buildpack/index.html
index 2bce5f5a5..4caf10ee7 100644
--- a/docs/for-platform-operators/concepts/buildpack/index.html
+++ b/docs/for-platform-operators/concepts/buildpack/index.html
@@ -8,7 +8,7 @@
-
@@ -23,7 +23,7 @@
-
@@ -301,6 +301,14 @@
-
For Platform Operators
--
- What are image extensions?
+
-
+ What is a composite buildpack?
-
-
--
- Tutorials
-
@@ -675,6 +678,9 @@
-
Concepts
+-
+ What is a buildpack?
+
-
What is the lifecycle?
@@ -696,6 +702,12 @@
-
What is a component buildpack?
+-
+ What is a composite buildpack?
+
+-
+ What is an image extension?
+
-
What is the build plan?
@@ -707,6 +719,15 @@
-
Write buildpacks
+-
+ Get started
+
+-
+ Use the build plan
+
+-
+ Create dependency layers
+
-
Specify process types
@@ -719,9 +740,6 @@
-
Clear the buildpack environment
--
- Create dependency layers
-
-
Create slice layers
@@ -733,9 +751,6 @@
-
Use exec.d binaries to configure the application at runtime
-
--
- Use the build plan
@@ -758,6 +773,9 @@
+-
+ Craft a buildpack order
+
-
Migrate
@@ -796,14 +814,17 @@
-
Configuration
+-
+ project.toml
+
-
builder.toml
+-
+ buildpack.toml
+
-
package.toml
-
--
- project.toml
@@ -851,28 +872,42 @@
What is a buildpack?
A buildpack
is software that examines your source code and determines the best way to build it.
A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
Buildpacks allow application developers to focus on what they do best - writing code, without having to worry about image security, optimizing container images, or container build strategy.
+How much time have you spent struggling to wrangle yet another Dockerfile? Copying and pasting random Dockerfile snippets into every project? Buildpacks can help! They are a better approach to building container images for applications.
+Typical buildpacks consist of at least three files:
buildpack.toml
– provides metadata about your buildpackbin/detect
– determines whether buildpack should be appliedbin/build
– executes build logicbuildpack.toml
– provides metadata about the buildpack, containing information such as its name, ID, and version.bin/detect
– performs detect.bin/build
– performs build.Each buildpack has two jobs to do
+The buildpack determines if it is needed or not.
+For example:
+requirements.txt
or a setup.py
file.package-lock.json
file.The buildpack transforms application source code in some way, for example by
+For example:
+pip install -r requirements.txt
if it detected a requirements.txt
file.npm install
if it detected a package-lock.json
file.There is a different type of buildpack commonly referred to as a meta-buildpack. It contains only a
-buildpack.toml
file with an order
configuration that references other buildpacks. This is useful for
-composing more complex detection strategies.
There are two essential steps that allow buildpacks to create a runnable image.
-A platform sequentially tests groups of buildpacks against your app’s source code. The first group that deems itself fit for your source code will become the selected set of buildpacks for your app.
-Detection criteria is specific to each buildpack – for instance, an NPM buildpack might look for a package.json
, and a Go buildpack might look for Go source files.
During build the buildpacks contribute to the final application image. This contribution could be as simple as setting some environment variables within the image, creating a layer containing a binary (e.g: node, python, or ruby), or adding app dependencies (e.g: running npm install
, pip install -r requirements.txt
, or bundle install
).
Buildpacks can be packaged as OCI images on an image registry or Docker daemon. This includes meta-buildpacks.
-Learn more about buildpacks by referring to the Buildpack API.
diff --git a/docs/for-platform-operators/concepts/composite-buildpack/index.html b/docs/for-platform-operators/concepts/composite-buildpack/index.html new file mode 100644 index 000000000..96eae163c --- /dev/null +++ b/docs/for-platform-operators/concepts/composite-buildpack/index.html @@ -0,0 +1,951 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A composite buildpack, also sometimes called a “meta-buildpack”,
+is a buildpack that does not contain any ./bin/detect
or ./bin/build
binaries,
+but instead references other buildpacks in its buildpack.toml
via the [[order]]
array.
This is useful for composing more complex detection strategies.
+ + + + +Image extensions generate Dockerfiles that can be used to extend base images for buildpacks builds.
-An image extension
is software that generates Dockerfiles that can be used to extend base images for buildpacks builds.
Buildpacks can do a lot, but there are some things buildpacks can’t do. They can’t install operating system packages, for example. Why not?
Buildpacks do not run as the root
user and cannot make arbitrary changes to the filesystem. This enhances security,
@@ -861,24 +882,17 @@
This has been a longstanding source of discussion within the CNB project: how can we preserve the benefits of buildpacks while enabling more powerful capabilities?
-Buildpacks are often presented as an alternative to Dockerfiles, but we think buildpacks and Dockerfiles can work together.
Buildpacks are optimized for creating layers that are efficient and logically mapped to the dependencies that they provide. By contrast, Dockerfiles are the most-used and best-understood mechanism for constructing base images and installing OS-level dependencies for containers.
The CNB Dockerfiles feature allows Dockerfiles to “provide” dependencies that buildpacks “require” through a -shared build plan, by introducing the concept of image extensions.
-Image extensions are buildpack-like components that use a restricted Dockerfile
syntax to expand base images. Their
purpose is to generate Dockerfiles that can be used to extend the builder or run images prior to buildpacks builds.
Like buildpacks, extensions participate in the detect
phase - analyzing application source code to determine if they
-are needed. During detect
, extensions can contribute to
-the build plan - recording dependencies that they are able to "
-provide" (though unlike buildpacks, they can’t “require” anything).
If the provided order contains extensions, the output of detect
will be a group of image extensions and a group of
-buildpacks that together produce a valid build plan. Image extensions only generate Dockerfiles - they don’t create
-layers or participate in the build
phase.
An image extension could be defined with the following directory:
.
├── extension.toml <- similar to a buildpack buildpack.toml
@@ -886,53 +900,27 @@ What are image extensions?
│ ├── detect <- similar to a buildpack ./bin/detect
│ ├── generate <- similar to a buildpack ./bin/build
extension.toml
describes the extension, containing information such as its name, ID, and version../bin/detect
is invoked during the detect
phase. It analyzes application source code to determine if the extension
+extension.toml
provides metadata about the extension, containing information such as its name, ID, and version../bin/detect
performs detect. It analyzes application source code to determine if the extension
is needed and contributes build plan entries../bin/generate
is invoked during the generate
phase (a new lifecycle phase that happens after detect
). It
+./bin/generate
performs generate (a new lifecycle phase that happens after detect
). It
outputs either or both of build.Dockerfile
or run.Dockerfile
for extending the builder or run image.Each image extension has two jobs to do
+The extension determines if it is needed or not.
+Like buildpacks, extensions participate in the detect
phase - analyzing application source code to determine if they
+are needed. During detect
, extensions can contribute to
+the build plan - recording dependencies that they are able to "
+provide" (though unlike buildpacks, they can’t “require” anything).
If the provided order contains extensions, the output of detect
will be a group of image extensions and a group of
+buildpacks that together produce a valid build plan. Image extensions only generate Dockerfiles - they don’t create
+layers or participate in the build
phase.
The extension outputs Dockerfiles that can be used to extend either or both of the build-time base image and the runtime base image.
For more information and to see a build in action, see authoring an image extension.
-Platforms may wish to use image extensions if they wish to provide the flexibility of modifying base images dynamically -at build time.
-Image extensions are considered experimental and susceptible to change in future API versions. However, image extension -should be used with great care. Platform operators should be mindful that:
-build
when using extensions.The ordering of lifecycle phases looks like the following:
-analyze
detect
- after standard detection, detect
will also run extensions’ ./bin/generate
; output Dockerfiles are
-written to a volumerestore
extend
- applies one or more build.Dockerfile
s to the builder imageextend
- applies one or more run.Dockerfile
s to the run image (could run in parallel with builder image extension)build
export
For more information, consult the migration guide.
-Supported:
-0.30.0
and above)Needs support:
-Your feedback is appreciated! As the feature evolves, we want to hear from you - what’s going well, what’s challenging, -and anything else you’d like to see. Please reach out in Slack (#buildpacks channel) -or GitHub.
@@ -942,12 +930,12 @@A buildpack
is software that examines your source code and determines the best way to build it.
A buildpack
is software that transforms application source code into runnable artifacts
+by analyzing the code and determining the best way to build it.
Image extensions generate Dockerfiles that can be used to extend base images for buildpacks builds.
+A composite buildpack, also sometimes called a “meta-buildpack”, is a buildpack that does not contain any ./bin/detect or ./bin/build binaries, but instead references other buildpacks in its buildpack.toml via the [[order]] array. +This is useful for composing more complex detection strategies.
+ + +An image extension
is software that generates Dockerfiles that can be used to extend base images for buildpacks builds.
For processes from older buildpacks, upgrading the platform will not change the command invocation.
Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see here for more information). Image extensions output Dockerfiles which are applied by the lifecycle using [kaniko][https://github.com/GoogleContainerTools/kaniko], a tool for building container images in Kubernetes, as a library.
+Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see here for more information). Image extensions output Dockerfiles which are applied by the lifecycle using [kaniko][https://github.com/GoogleContainerTools/kaniko], a tool for building container images in Kubernetes, as a library.
Note: image extensions are not supported for Windows container images.
pack
version in use is at least 0.28.0
and enable experimental features: pack config experimental
.A builder configuration schema is as follows:
+The builder config file is used for creating builders.
+The schema is as follows:
description
(string, optional)build.env
(optional)Currently, when specifying a URI to a buildpack or lifecycle, only tar
or tgz
archive types are supported.
The buildpack configuration file is a necessary component of a buildpack.
+The schema is as follows:
+api
(string, required, current: 0.10
)
+The Buildpack API version the buildpack adheres to. Used to ensure compatibility against
+the lifecycle.
++Not to be confused with Cloud Foundry or Heroku buildpack versions. +This version pertains to the interface between the buildpack and the lifecycle of Cloud Native Buildpacks.
+
buildpack
(required)
+Information about the buildpack.
id
(string, required)
+A globally unique identifier.
version
(string, required)
+The version of the buildpack.
name
(string, required)
+Human readable name.
clear-env
(boolean, optional, default: false
)
+Clears user-defined environment variables when true
on executions of bin/detect
and bin/build
.
homepage
(string, optional)
+Buildpack homepage.
description
(string, optional)
+A short description of the buildpack.
keywords
(string(s), optional)
+Keywords to help locate the buildpack. These can be useful if publishing to the Buildpack Registry.
sbom-formats
(string(s), optional)
+SBOM formats output by the buildpack. Supported values are the following media types: application/vnd.cyclonedx+json
, application/spdx+json
, and application/vnd.syft+json
.
licenses
(list, optional)
+A list of licenses pertaining to the buildpack.
type
(string, optional)
+The type of the license. This may use the SPDX 2.1 license expression, but it is not limited to identifiers in the SPDX Licenses List. If the buildpack is using a nonstandard license, then the uri
key may be specified in lieu of or in addition to type
to point to the license.
uri
(string, optional)
+A URL or path to the license.
targets
(list, optional)
+A list of targets supported by the buildpack.
+When no targets are specified, the os
/arch
will be inferred from the contents of the ./bin
directory
+(./bin/build
implies linux
/amd64
and ./bin/build.bat
implies windows
/amd64
).
+For each target, all fields are optional (though at least one should be provided).
+Cannot be used in conjunction with order
list.
os
(string, optional)
+The supported operating system name.
arch
(string, optional)
+The supported architecture.
variant
(string, optional)
+The supported architecture variant.
targets.distros
(optional)
+A list of supported distributions for the given operating system, architecture, and architecture variant.
name
(string, optional)
+The supported operating system distribution name.
version
(string, optional)
+The supported operating system distribution version.
stacks
(list, deprecated, optional)
+A list of stacks supported by the buildpack.
+Cannot be used in conjunction with order
list.
id
(string, required)
+The id of the supported stack.
mixins
(string list, required)
+A list of mixins required on the stack images.
order
(list, optional)
+A list of buildpack groups for the purpose of creating a [meta-buildpack][meta-buildpack]. This list determines the
+order in which groups of buildpacks will be tested during detection. If omitted, targets
or stacks
list must be present.
+Cannot be used in conjunction with targets
or stacks
list.
group
(list, required)
+A list of buildpack references.
id
(string, required)
+The identifier of a buildpack being referred to.
+Buildpacks with the same ID may appear in multiple groups at once but never in the same group.
version
(string, required)
+The version of the buildpack being referred to.
optional
(boolean, optional, default: false
)
+Whether this buildpack is optional during detection.
metadata
(any, optional)
+Arbitrary data for buildpack.
The project descriptor file allows app developers to provide configuration for apps, services, functions and buildpacks.
+ + +Schema of the builder config file.
+The builder config file is used for creating builders.
-Schema of the buildpack package config file.
+The buildpack configuration file is a necessary component of a buildpack.
-Schema of the project descriptor file.
+The package config file is used for packaging buildpacks for distribution as OCI images or tar files.
A buildpackage configuration schema is as follows:
+The package config file is used for packaging buildpacks for distribution as OCI images or tar files.
+The schema is as follows:
buildpack
(required)buildpack
(required)dependencies
(list, optional)A set of dependent buildpack locations, for packaging a meta-buildpack. Each dependent buildpack location must correspond to an order group within the meta-buildpack being packaged, and must have one of the following fields:
+A set of dependent buildpack locations, for packaging a meta-buildpack. Each dependent buildpack location must correspond to an order group within the meta-buildpack being packaged, and must have one of the following fields:
uri
(string).cnb
file), or a directory. If path is relative, it must be relative to the package.toml
.platform
(optional)You can view sample buildpackages on Github.
-A project descriptor allows users to detail configuration for apps, services, functions and buildpacks. It should, by
-default, be named project.toml
, though users can name it differently, and pass the filename to pack
by calling
The project descriptor file allows app developers to provide configuration for apps, services, functions and buildpacks.
+It should, by default, be named project.toml
, though users can name it differently, and pass the filename to pack
by calling
$ pack build --descriptor <project-descriptor path>
-
The schema for the project descriptor
is:
The schema is as follows:
_
(table, optional)For more detail, you can check out the project.toml
specification
This section provides an overview of the Cloud Native Buildpack API specification.
-Most buildpack users won’t need this information unless they are writing a buildpack or -a platform that supports buildpacks.
+The Cloud Native Buildpacks specification defines the APIs that buildpacks, platforms, and the lifecycle must implement.
+Most buildpack users won’t need this information unless they are writing a buildpack or a platform that supports buildpacks.
diff --git a/docs/reference/spec/buildpack-api/index.html b/docs/reference/spec/buildpack-api/index.html index c8c4a5b4e..003299f28 100644 --- a/docs/reference/spec/buildpack-api/index.html +++ b/docs/reference/spec/buildpack-api/index.html @@ -8,7 +8,7 @@ - @@ -23,7 +23,7 @@ - @@ -301,6 +301,14 @@This specification defines the interface between a buildpack and the environment that runs it. -This API will be used by buildpack authors.
-A buildpack must contain three files:
-buildpack.toml
bin/detect
bin/build
The two files in bin/
must be executable. They can be shell scripts written in a language like Bash or they
-can be executables compiled from a language like Go.
bin/detect
bin/detect
-
This entrypoint is used to determine if a buildpack should -run against a given codebase. It will often check for the existence of a particular -file or some configuration indicating what kind of application has been provided. -Two environment variables identify important file system paths:
-CNB_PLATFORM_DIR
- a directory containing platform provided configuration, such as environment variables.CNB_BUILD_PLAN_PATH
- a path to a file containing the Build Plan.In addition, the working directory is defined as the location of the codebase -the buildpack will execute against.
-The executable must return an exit code of 0
if the codebase can be serviced by this buildpack, and 100
if it cannot.
-Other exit codes indicate an error during detection.
This is a simple example of a buildpack that detects a Python application by
-checking for the presence of a requirements.txt
file:
#!/bin/sh
-
-if [ -f requirements.txt ]; then
- echo "Python Buildpack"
- exit 0
-else
- exit 100
-fi
-
bin/build
bin/build
-
This entrypoint transforms a codebase. -It will often resolve dependencies, install binary packages, and compile code. -Three environment variables identify important file system paths:
-CNB_LAYERS_DIR
- a directory that may contain subdirectories representing each layer created by the buildpack in the final image or build cache.CNB_PLATFORM_DIR
- a directory containing platform provided configuration, such as environment variables.CNB_BP_PLAN_PATH
- a path to a file containing the Build Plan.In addition, the working directory is defined as the location of the codebase -this buildpack will execute against.
-All changes to the codebase in the working directory will be included in the final
-image, along with any launch layers created in the CNB_LAYERS_DIR
.
Each directory created by the buildpack under the CNB_LAYERS_DIR
can be used for any
-of the following purposes:
A buildpack defines how a layer will by used by creating a <layer>.toml
with
-a name matching the directory it describes in the CNB_LAYERS_DIR
. For example, a
-buildpack might create a $CNB_LAYERS_DIR/python
directory and a $CNB_LAYERS_DIR/python.toml
-with the following contents:
launch = true
-cache = true
-build = true
-
In this example, the python
directory will be included in the run image,
-cached for future builds, and will be accessible to subsequent buildpacks.
This is a simple example of a buildpack that runs Python’s pip
package manager
-to resolve dependencies:
#!/bin/sh
-
-PIP_LAYER="$CNB_LAYERS_DIR/pip"
-mkdir -p "$PIP_LAYER/modules" "$PIP_LAYER/env"
-
-pip install -r requirements.txt -t "$PIP_LAYER/modules" \
- --install-option="--install-scripts=$PIP_LAYER/bin" \
- --exists-action=w --disable-pip-version-check --no-cache-dir
-
-echo "launch = true" > "$PIP_LAYER.toml"
-
buildpack.toml
A buildpack must contain a buildpack.toml
file in its root directory.
api = "0.10"
-
-[buildpack]
-id = "example.com/python"
-version = "1.0"
-
-# Targets the buildpack will work with
-[[targets]]
-os = "linux"
-
-# Stacks (deprecated) the buildpack will work with
-[[stacks]]
-id = "io.buildpacks.stacks.jammy"
-
The schema is as follows:
-api
(string, required, current: 0.10
)
-The Buildpack API version the buildpack adheres to. Used to ensure compatibility against
-the lifecycle.
--Not to be confused with Cloud Foundry or Heroku buildpack versions. This version pertains to the interface -between the buildpack and the lifecycle of Cloud Native Buildpacks.
-
buildpack
(required)
-Information about the buildpack.
id
(string, required)
-A globally unique identifier.
version
(string, required)
-The version of the buildpack.
name
(string, required)
-Human readable name.
clear-env
(boolean, optional, default: false
)
-Clears user-defined environment variables when true
on executions of bin/detect
and bin/build
.
homepage
(string, optional)
-Buildpack homepage.
description
(string, optional)
-A short description of the buildpack.
keywords
(string(s), optional)
-Keywords to help locate the buildpack. These can be useful if publishing to the Buildpack Registry.
sbom-formats
(string(s), optional)
-SBOM formats output by the buildpack. Supported values are the following media types: application/vnd.cyclonedx+json
, application/spdx+json
, and application/vnd.syft+json
.
licenses
(list, optional)
-A list of licenses pertaining to the buildpack.
type
(string, optional)
-The type of the license. This may use the SPDX 2.1 license expression, but it is not limited to identifiers in the SPDX Licenses List. If the buildpack is using a nonstandard license, then the uri
key may be specified in lieu of or in addition to type
to point to the license.
uri
(string, optional)
-A URL or path to the license.
targets
(list, optional)
-A list of targets supported by the buildpack.
-When no targets are specified, the os
/arch
will be inferred from the contents of the ./bin
directory
-(./bin/build
implies linux
/amd64
and ./bin/build.bat
implies windows
/amd64
).
-For each target, all fields are optional (though at least one should be provided).
-Cannot be used in conjunction with order
list.
os
(string, optional)
-The supported operating system name.
arch
(string, optional)
-The supported architecture.
variant
(string, optional)
-The supported architecture variant.
targets.distros
(optional)
-A list of supported distributions for the given operating system, architecture, and architecture variant.
name
(string, optional)
-The supported operating system distribution name.
version
(string, optional)
-The supported operating system distribution version.
stacks
(list, deprecated, optional)
-A list of stacks supported by the buildpack.
-Cannot be used in conjunction with order
list.
id
(string, required)
-The id of the supported stack.
mixins
(string list, required)
-A list of mixins required on the stack images.
order
(list, optional)
-A list of buildpack groups for the purpose of creating a meta-buildpack. This list determines the
-order in which groups of buildpacks will be tested during detection. If omitted, targets
or stacks
list must be present.
-Cannot be used in conjunction with targets
or stacks
list.
group
(list, required)
-A list of buildpack references.
id
(string, required)
-The identifier of a buildpack being referred to.
-Buildpacks with the same ID may appear in multiple groups at once but never in the same group.
version
(string, required)
-The version of the buildpack being referred to.
optional
(boolean, optional, default: false
)
-Whether this buildpack is optional during detection.
metadata
(any, optional)
-Arbitrary data for buildpack.
The Build Plan is a document the buildpacks can use to pass information between the detect and build phases. The build plan is passed (by the lifecycle) as a parameter to the detect
and build
binaries of the buildpack.
detect
phase, the buildpack(s) may write something it requires
or provides
(or both) into the Build Plan.build
phase, the buildpack(s) may read the Buildpack Plan (a condensed version of the Build Plan, composed by the lifecycle) to determine what it should do, and refine the Buildpack Plan with more exact metadata (eg: what version dependency it requires).A buildpack can require
or provide
multiple dependencies, and even multiple groupings of dependencies (using or
lists). Additionally, multiple buildpacks may require
or provide
the same dependency.
The lifecycle uses the Build Plan as one element in deciding whether or not a particular list of buildpacks is appropriate, by seeing whether all dependencies required can be provided by that list.
-Let’s walk through some possible cases a node-engine
buildpack may consider:
We will also consider what a NPM
and a JVM
buildpack may do.
A node-engine
buildpack is always happy to provide
the node
dependency. The build plan it will write may look something like:
[[provides]]
-name = "node"
-
--NOTE: If this was the only buildpack running, this would fail the
-detect
phase. In order to pass, everyprovides
must be matched up with arequires
, whether in the same buildpack or in another buildpack. See the spec for particulars on how ordering buildpacks can adjust detection results.
During the detect
phase, the node-engine
buildpack sees in one configuration file (e.g. a .nvmrc
file in the app directory) that node v10.x
is explicitly requested by the application. Seeing that, it may write the below text to the build plan:
[[provides]]
-name = "node"
-
-[[requires]]
-name = "node"
-version = "10.x"
-
-[requires.metadata]
-version-source = ".nvmrc"
-
As always, the buildpack provides
node
. In this particular case, a version of node
(10.x
) is being requested in a configuration file (.nvmrc
). The buildpack chooses to add an additional piece of metadata (version-source
), so that it can understand where that request came from.
NPM
is the default package manager for node
. A NPM Buildpack may ensure that all the packages for the application are present (by running npm install
), and perhaps cache those packages as well, to optimize future builds.
NPM is typically distributed together with node. As a result, a NPM buildpack may require node
, but not want to provide
it, trusting that the node-engine
buildpack will be in charge of providing
node
.
The NPM buildpack could write the following to the build plan, if the buildpack sees that npm
is necessary (e.g., it sees a package.json
file in the app directory):
[[requires]]
-name = "node"
-
If, looking in the package.json
file, the NPM buildpack sees a specific version of node
requested in the engines field (e.g. 14.1
), it may write the following to the build plan:
[[requires]]
-name = "node"
-version = "14.1"
-
-[requires.metadata]
-version-source = "package.json"
-
--NOTE: As above, if this was the only buildpack running, this would fail the
-detect
phase. In order to pass, everyprovides
must be matched up with arequires
, whether in the same buildpack or in another buildpack. See the spec for particulars on how ordering buildpacks can adjust detection results.
However, if the NPM Buildpack was run together with the Node Engine buildpack (which provides
node
), the lifecycle will see that all requirements are fulfilled, and select that group as the correct set of buildpacks.
Java is distributed in two formats - the jdk
(Java Development Kit), which allows for compilation and running of Java programs, and the jre
(Java Runtime Environment, which allows for running compiled Java programs). A very naive implementation of the buildpack may have it write several provides
options to the build plan, detailing everything that it can provide, while later buildpacks would figure out based on the application which options it requires, and would require
those. In this particular case, we can use the or
operator to present different possible build plans the buildpack can follow:
# option 1 (`jre` and `jdk`)
-[[provides]]
-name = "jre"
-
-[[provides]]
-name = "jdk"
-
-# option 2 (or just `jdk`)
-[[or]]
-[[or.provides]]
-name = "jdk"
-
-# option 3 (or just `jre`)
-[[or]]
-[[or.provides]]
-name = "jre"
-
The buildpack gives three options to the lifecycle:
-jre
jdk
jdk
and jre
As with the other buildpacks, this alone will not be sufficient for the lifecycle. However, other buildpacks that follow may require
certain things. For example, another buildpack may look into the application and, seeing that it is a Java executable, require
the jre
in order to run it. When the lifecycle analyzes the results of the detect phase, it will see that there is a buildpack which provides jre
, and a buildpack that requires jre
, and will therefore conclude that those options represent a valid set of buildpacks.
provides
(list, optional)
-A list of dependencies which the buildpack provides.
name
(string, required)requires
(list, optional)
-A list of dependencies which the buildpack requires.
name
(string, required)
-The name of the required dependency.
version
(string, optional)
-The version of the dependency required.
metadata
(object, optional)
-Any additional key-value metadata you wish to store.
or
(array, optional)
-A list of alternate requirements which the buildpack provides/requires. Each or
array must contain a valid Build Plan (with provides
and requires
)
For more information, see the Build Plan section of the spec.
+The Buildpack API specifies the interface between a lifecycle program and one or more buildpacks.
Given the buildpack and lifecycle both declare a Buildpack API version in format:
-<major>.<minor>
Then a buildpack and a lifecycle are considered compatible if all the following conditions are true:
-<major>
is 0
, then <minor>
s must match.<major>
is greater than 0
, then <minor>
of the buildpack must be less than
-or equal to that of the lifecycle.<major>
s must always match.Buildpack implements Buildpack API | -Lifecycle implements Buildpack API | -Compatible? | -
---|---|---|
0.2 |
-0.2 |
-yes | -
1.1 |
-1.1 |
-yes | -
1.2 |
-1.3 |
-yes | -
0.2 |
-0.3 |
-no | -
0.3 |
-0.2 |
-no | -
1.3 |
-1.2 |
-no | -
1.3 |
-2.3 |
-no | -
2.3 |
-1.3 |
-no | -
A buildpack only ever implements one Buildpack API version at a time.
+The implemented Buildpack API version can be found in the buildpack.toml
file in the buildpack’s root directory,
+or in a label on a buildpack package.
A lifecycle may (and usually does) support more than one Buildpack API version at a time.
+The supported Buildpack API version(s) can be found in the lifecycle.toml
file in a lifecycle tarball,
+or in a label on the lifecycle image.
A lifecycle “supports” a buildpack if they both declare support for the same Buildpack API version in format: <major>.<minor>
.
Two buildpacks of different Buildpack API versions can participate in the same build, +provided they are both supported by the lifecycle.
You can read the complete Buildpack API specification on Github.
diff --git a/docs/reference/spec/distribution-api/index.html b/docs/reference/spec/distribution-api/index.html index 7afc89111..b453e8142 100644 --- a/docs/reference/spec/distribution-api/index.html +++ b/docs/reference/spec/distribution-api/index.html @@ -301,6 +301,14 @@This section provides an overview of the Cloud Native Buildpack API specification.
-Most buildpack users won’t need this information unless they are writing a buildpack or -a platform that supports buildpacks.
-The Cloud Native Buildpack API specification consists of the following parts:
+The Cloud Native Buildpacks specification defines the APIs that buildpacks, platforms, and the lifecycle must implement.
+Most buildpack users won’t need this information unless they are writing a buildpack or a platform that supports buildpacks.
+The specification consists of the following:
This specification defines the interface between a buildpack and the environment that runs it. -This API will be used by buildpack authors.
+The Buildpack API specifies the interface between a lifecycle program and one or more buildpacks.