A buildpack is a program that turns source code into a runnable container image.
These buildpacks are bundled into a builder stack and are called upon to build an app.
The buildpack idea has been standardized with Cloud Native Buildpacks. 1)
Heroku is the originator of the buildpack idea.
One of the benefits of buildpacks is that they are multi-process - an image can have multiple entrypoints for each operational mode.
- Buildpacks are grouped together into a builder.
- Each buildpack will inspect the application source code and detect if it should participate in the build process. For example:
- a Go buildpack would look for files ending in *.go,
- a Ruby buildpack would look for *.rb files.
- an NPM buildpack might look for a package.json,
- a Go buildpack might look for Go source files.
- Every buildpack that has matched contribute to the build step.
A builder is an image that contains three components:
- a set of buildpacks, which provide your app’s dependencies
- a stack, which provides the OS layer for your app image
- the CNB lifecycle 2), which puts everything together to produce your final app image
A stack consists of two images:
- build image: the environment in which your app is built (when the buildpacks are analyzing the application source code and building the application’s container image)
- run image: the OS layer for your app image (the base of the final application image).