Let’s see a build that requires base image extension in order to succeed.
The buildpack always detects (because its exit code is
0) but doesn’t require any dependencies (as the output build plan is empty).
The buildpack tries to use
tree at build-time, and defines a launch process called
curl that runs
curl --version at runtime.
For now, it is necessary for the builder image to be pushed to an OCI registry for builds with image extensions to succeed.
For demo purposes, we will launch a local unauthenticated registry:
docker run -d --rm -p 5000:5000 registry:2
You can push the builder to any registry of your choice - just ensure that
docker login succeeds and replace
localhost:5000 in the following examples with your registry namespace -
Create the builder:
pack builder create localhost:5000/extensions-builder \ --config $PWD/samples/builders/alpine/builder.toml \ --publish
pack build (note that the “source” directory is effectively ignored in our example):
pack build hello-extensions \ --builder localhost:5000/extensions-builder \ --network host \ --path $PWD/samples/apps/java-maven \ --pull-policy always \ --verbose
--network host is necessary when publishing to a local registry.
You should see:
[detector] ======== Results ======== [detector] pass: email@example.com [detector] pass: firstname.lastname@example.org [detector] Resolving plan... (try #1) [detector] skip: email@example.com provides unused tree [detector] 1 of 2 buildpacks participating [detector] samples/hello-extensions 0.0.1 ... [extender] Running build command [extender] ---> Hello Extensions Buildpack [extender] /cnb/buildpacks/samples_hello-extensions/0.0.1/bin/build: line 6: tree: command not found [extender] ERROR: failed to build: exit status 127
What happened: our builder doesn’t have
tree installed, so the
hello-extensions buildpack failed to build (as it
tries to run
tree --version in its
Even though there is a
samples/tree extension that passed detection (
pass: firstname.lastname@example.org), because
hello-extensions buildpack didn’t require
tree in the build plan, the extension was omitted from the detected
skip: email@example.com provides unused tree).
Let’s take a look at how the
samples/tree extension installs
tree on the builder image…