This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.6.4. Use custom builder image
You can define a BuildConfig object that uses the custom strategy in conjunction with your custom builder image to execute your custom build logic.
Prerequisites
- Define all the required inputs for new custom builder image.
- Build your custom builder image.
Procedure
Create a file named
buildconfig.yaml. This file defines theBuildConfigobject that is created in your project and executed:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify your project name.
Create the
BuildConfig:oc create -f buildconfig.yaml
$ oc create -f buildconfig.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file named
imagestream.yaml. This file defines the image stream to which the build will push the image:kind: ImageStream apiVersion: v1 metadata: name: sample-custom spec: {}kind: ImageStream apiVersion: v1 metadata: name: sample-custom spec: {}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the imagestream:
oc create -f imagestream.yaml
$ oc create -f imagestream.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run your custom build:
oc start-build sample-custom-build -F
$ oc start-build sample-custom-build -FCopy to Clipboard Copied! Toggle word wrap Toggle overflow When the build runs, it launches a pod running the custom builder image that was built earlier. The pod runs the
build.shlogic that is defined as the entrypoint for the custom builder image. Thebuild.shlogic invokes Buildah to build thedockerfile.samplethat was embedded in the custom builder image, and then uses Buildah to push the new image to thesample-custom image stream.