Buildpacks allow you to convert your source code into a secure, efficient, production ready container image.
Buildpacks provide framework and runtime support for applications. Buildpacks examine your apps to determine all the dependencies it needs and configure them appropriately to run on any cloud.
Each buildpack comprises of two phases -
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
build stage for a specific buildpack is skipped.
package-lock.jsonfile to pass
build phase runs against your source code to -
pip install -r requirements.txtif it detected a
npm installif it detected a
Builders are an ordered combination of
buildpacks with a base
build image, a lifecycle, and reference to a
run image. They take in your
app source code and build the output
app image. The
build image provides the base environment for the
builder (for eg. an Ubuntu Bionic OS image with build tooling) and a
run image provides the base environment for the
app image during runtime. A combination of a
build image and a
run image is called a
Under the hood a builder uses the
lifecycle to run the
detect phase for all the
buildpacks it contains in order and then proceeds to run the
build phase of all the
buildpacks that passed detection.
This allows us to have a single
builder that can detect and build various kinds of applications automatically.
For example, let’s say
demo-builder contains the
Node buildpack. Then -
demo-builderwill only run the Python
demo-builderwill only run the Node
demo-builderwill run both the Python and Node
demo-builderwill fail to