Source-to-image build

Source-to-image (S2I) is a tool for building reproducible container images. It produces ready-to-run images by injecting application source into a container image and assembling a new image. The new image incorporates the base image, the builder, and built source and is ready to use with the buildah run command. S2I supports incremental builds, which re-use previously downloaded dependencies, previously built artifacts, and so on.

Perform source-to-image incremental builds

Source-to-image (S2I) can perform incremental builds, which means it reuses artifacts from previously-built images.

See S2I Requirements for information on how to create a builder image supporting incremental builds.

Procedure
  • To create an incremental build, apply the following modification to the strategy definition:

    strategy:
      sourceStrategy:
        from:
          kind: "ImageStreamTag"
          name: "incremental-image:latest"
        incremental: true

    where:

    strategy.sourceStrategy.from.name

    Specifies an image that supports incremental builds. Consult the documentation of the builder image to determine if it supports this behavior.

    strategy.sourceStrategy.incremental

    Specifies whether an incremental build is attempted. If the builder image does not support incremental builds, the build will still succeed, but you will get a log message stating the incremental build was not successful because of a missing save-artifacts script.