Chapter 9. Customizing Source-to-Image Builds
Rather than creating an S2I builder from scratch, it is more typical that you will require only minor customizations to the behavior of the S2I builder image for a specific application.
A well-designed S2I builder image should provide the ability to customize the behavior for common use cases using environment variables set during the build or at the time of deployment.
When the S2I builder doesn’t do this, or your use case requires additional steps to be run, you will need to override the behavior of the default assemble and run scripts.
In this chapter you will learn about the different ways that the S2I assemble and run scripts can be overridden or extended. This can be done by including different versions of the scripts with your application source code; by hosting them on a separate web server and referencing them from the build configuration; or, if you only wish to override the run script, by mounting it into a container from a config map or persistent volume.
You will also learn how you can create a modified S2I builder by using the Source build strategy to build the image, rather than the Docker build strategy.
Using Environment Variables
When using an existing S2I builder, the hope is that the authors of that builder have designed it with flexibility in mind—that is, that they have allowed the behavior of the S2I builder to be customized through configuration, both when the builder is being run to create an application image ...
Get Deploying to OpenShift now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.