Source-to-Image Let’s have a quick look at what an S2I builder image looks like. We won’t go into too many details here, but an S2I builder image is a standard container image that con‐ tains a set of S2I scripts, with two mandatory commands we have to provide: assemble The script that gets called when the build starts. Its task is to take the source given by one of the configured inputs, compile it if necessary, and copy the final artifacts to the proper locations. run Used as an entry point for this image. OpenShift calls this script when it deploys the image. This run script uses the generated artifacts to deliver the application services. Optionally you can also script to provide a usage message, saving the generated arti‐ facts for so-called  incremental builds  that are accessible by the  assemble  script in a subsequent build run or add some sanity checks. Let’s have a closer look at an S2I build in Figure 25-1. An S2I build has two ingredi‐ ents: a builder image and a source input. Both are brought together by the S2I build system when a build is started—either because a trigger event was received or because we started it manually. When the build image has finished by, for example, compiling the source code, the container is committed to an image and pushed to the config‐ ured ImageStreamTag. This image contains the compile and prepared artifacts, and the image’s  run  script is set as the entry point. Example 25-1 shows a simple Java S2I build with a Java S2I image. This build takes a source, the builder image, and produces an output image that is pushed to an Image‐ StreamTag. It can be started manually via  oc start-build  or automatically when the builder images changes. Figure 25-1. S2I Build with Git Source as input Solution  |  225