Including pack
and kpack
.
pack
, docker
, and dive
CLI tools
brew install buildpacks/tap/pack docker dive
kubectl
and kp
CLI tools
brew install kubernetes-cli vmware-tanzu/kpack-cli/kp
- Docker
- A Kubernetes cluster with at least 4GB memory
- If using Colima, start it with
colima start -k -m4 -ax86_64
- You may also need to export the location of the Docker daemon:
export DOCKER_HOST=unix://$HOME/.colima/default/docker.sock
0. Prepare the environment
- Clone the Paketo Buildpacks sample apps, paketo-buildpacks/samples, to a local directory
git clone https://github.com/paketo-buildpacks/samples.git
- Install
kpack
into the Kubernetes cluster as described here
kubectl apply -f https://github.com/pivotal/kpack/releases/download/v0.9.2/release-0.9.2.yaml
- In your GitHub and Docker Hub account settings, create personal access tokens for each and set them in creds.yml
- Create the secrets for GitHub and Docker Hub
kubectl apply -f creds.yml
- Create the stack, store and builder
kubectl apply -f builder.yml
Resetting after a previous run
- Delete any images previously created by
pack
- Delete the
kpack
resources for the stack, store, builder and image
kubectl delete -f builder.yml -f image.yml
- Delete builder and app image from Docker Hub (wait for deletion to finish)
- Re-create the stack, store and builder
kubectl apply -f builder.yml
- Get into one of the subdirectories containing a sample app
- Examine the contents (note lack of Dockerfile or any other build config)
- Make sure
pack
is installed
- See what builders
pack
suggests
- Build the app into an image using the Paketo base builder
pack build my-nodejs-app --builder paketobuildpacks/builder:base
- Check that the image was built and is available locally
- Examine how the layers are composed in the image
- Download the SBOM from the image
pack sbom download my-nodejs-app
docker inspect my-nodejs-app
- If you ran
pack
in a sample app above, get back to the directory containing the kpack resources
- Check that
kp
is installed
- Make sure the
kpack
CRDs are present in the cluster
kubectl api-resources | grep kpack
- Check the readiness of the stack, store and builder
kubectl get clusterstack,clusterstore,builder
- Check the builder image on Docker Hub
Create the Image
and watch a build
- Apply the
Image
manifest
kubectl apply -f image.yml
- Check that the
Image
spawned a Build
and a build pod
kubectl get image,build,po
- Look into the composition of the build pod, in particular the init containers
kubectl describe pod/my-nodejs-app-build-1-build-pod
- Stream the build logs using
kp
kp builds logs my-nodejs-app
- Check that a new app image was published to Docker Hub
Simulate a buildpack/store update
- Edit the store configuration, changing the
nodejs
image version from 1.0.0
to 1.1.0
kubectl edit clusterstore nodejs
- After a short pause, check that the builder has been updated (spot "Observed Store Generation" and buildpack version)
kubectl describe builder my-nodejs-builder
- Check that a new builder image was published to Docker Hub
- Find the new
Build
and the new build pod
kubectl get image,build,po
- Stream the build logs using
kp
kp builds logs my-nodejs-app
- Check that a new app image was published to Docker Hub