Chapter 8. Understanding Source-to-Image Builders

The Docker build strategy provides the most control over how to build an image. Because of the potential security risks with allowing Docker builds within a shared OpenShift cluster, the ability to use the Docker build strategy would usually be restricted to trusted developers.

The most common method for building applications is therefore using the S2I builders. To get the most out of the S2I builders, it is helpful to understand how they work.

In this chapter you will delve into how S2I builders work and how to implement a simple S2I builder image. You will also be shown how to add annotations to the image for your custom S2I builder so that it can be selected and used from the OpenShift web console.

The Source-to-Image Project

The process of building an image from application source code in OpenShift makes use of a toolkit and workflow originating from the open source Source-to-Image project.

The S2I toolkit produces ready-to-run images by injecting source files into a running instance of a builder base image, with scripts in the builder image turning that source code into a runnable application. From the container the build process was run in, a runnable application image is then created.

The command-line tool that drives the S2I build process is called s2i. When you deploy an application from source code in OpenShift using S2I, all the steps involved in running the s2i command-line tool are done for you. It is possible, however, ...

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.