You are viewing documentation for KubeSphere version:v3.0.0
KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
S2I Workflow and Logic
Source-to-Image (S2I) is an automation tool for building images from source code. S2I injects source code into an Image Builder for compiling and then automatically packages the compiled code into a Docker image.
For more information about how to use S2I in KubeSphere, refer to Source to Image: Publish an App without a Dockerfile. Besides, you can refer to the code repositories S2IOperator and S2IRun for more details.
S2I Workflow and Logic
Image Builder
For interpreted languages like Python and Ruby, the build-time and runtime environments for an application are typically the same. For example, a Ruby-based Image Builder usually contains Bundler, Rake, Apache, GCC, and other packages needed to set up a runtime environment. The following diagram describes the build workflow.
How S2I works
S2I performs the following steps:
- Start a container from the Image Builder with the application source code injected into a specified directory.
- Execute the
assemble
script from the Image Builder to build that source code into a ready-to-run application by installing dependencies and moving the source code into a working directory. - Set the
run
script provided by the Image Builder as the image entrypoint for starting the container, and then commit a new image as the application image to meet user needs.
See the S2I workflow chart as below.
Runtime Image
For compiled languages like Go, C, C++, or Java, the dependencies necessary for compiling will increase the size of resulting images. To build slimmer images, S2I uses a phased build workflow with unnecessary files removed from images. An artifact, which is an executable like a Jar file or binary file, will be extracted when building finishes in the Image Builder, and then injected into a Runtime Image for execution.
See the building workflow as below.