The extension always detects (because its exit code is
0) and provides a dependency called
tree by writing to the build plan.
The extension generates a
build.Dockerfile that installs
tree on the builder image.
hello-extensionsupdated to require
$PWD/samples/buildpacks/hello-extensions/bin/detect to uncomment the first set of lines that output
[[requires]] to the build plan:
sed -i "10,11s/#//" $PWD/samples/buildpacks/hello-extensions/bin/detect
(On Mac, use
sed -i '' "10,11s/#//" $PWD/samples/buildpacks/hello-extensions/bin/detect)
Re-create the builder:
pack builder create localhost:5000/extensions-builder \ --config $PWD/samples/builders/alpine/builder.toml \ --publish
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: firstname.lastname@example.org [detector] pass: email@example.com [detector] Resolving plan... (try #1) [detector] samples/tree 0.0.1 [detector] samples/hello-extensions 0.0.1 [detector] Running generate for extension firstname.lastname@example.org ... [extender] Found build Dockerfile for extension 'samples/tree' [extender] Applying the Dockerfile at /layers/generated/build/samples_tree/Dockerfile... ... [extender] Running build command [extender] ---> Hello Extensions Buildpack [extender] tree v1.8.0 (c) 1996 - 2018 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro ... Successfully built image hello-extensions
docker run --rm hello-extensions
You should see:
ERROR: failed to launch: path lookup: exec: "curl": executable file not found in $PATH
What happened: our builder uses run image
cnbs/sample-stack-run:alpine, which does not have
curl installed, so our
process failed to launch.
Let’s take a look at how the
samples/curl extension fixes the error by switching the run image to another image…