What is Shipwright?

Shipwright is a Kubernetes-native build framework that provides a declarative API for building container images. It abstracts away the complexity of container builds by defining BuildStrategies that encapsulate build tools and processes. migetpacks integrates with Shipwright as a ClusterBuildStrategy, allowing you to build application containers directly from source code using Kubernetes-native resources.

ClusterBuildStrategy

The ClusterBuildStrategy defines how migetpacks runs inside the cluster. It specifies the builder image, volumes, and parameters available to builds.
The privileged: true security context is required because migetpacks uses Docker-in-Docker (DinD) to build container images.

Volumes

migetpacks uses several volume types in Shipwright builds:

Environment Variables

Pass environment variables to customize the build behavior. These can be set directly in the BuildStrategy or passed through the Build resource.
Any environment variable not in the known builder variables list is automatically injected into the generated Dockerfile as an ENV statement. This is useful for passing build-time configuration like NODE_OPTIONS or RAILS_MASTER_KEY.

RESULT_FILE for Post-Build Steps

When RESULT_FILE is set, migetpacks writes a JSON file containing build results. This enables post-build steps (like deployment notifications) to access build metadata. The builder always exits with code 0 to ensure post-build steps execute. Check the status field in the result JSON to determine if the build succeeded or failed.

Build Resource

The Build resource defines what to build and where to push the result.

BuildRun Resource

A BuildRun triggers an actual build execution.
You can also create a BuildRun that overrides the output image:

Full Example with Cache and Results

This complete example shows a ClusterBuildStrategy with build caching, registry mirror, and a post-build notification step: