Source-to-Image (S2I) Build¶
Source-to-Image (S2I) is an OpenShift build strategy that takes application source code from a Git repository and produces a runnable container image — no Containerfile required. The developer provides source code, OpenShift provides the builder image, and S2I handles the rest.
This is one of the key differentiators between OpenShift and vanilla Kubernetes. It enables developers to go from Git push to running application without needing to understand container image builds.
How It Works¶
Git Repository ──> S2I Builder Image ──> Application Image ──> Deployment
(source code) (language runtime) (built by OpenShift) (running pods)
- OpenShift clones the source repo
- The builder image compiles/packages the application
- The resulting image is pushed to the internal registry
- A Deployment and Service are created automatically
Deploy a Python Application¶
-
Create a namespace:
-
Deploy from a Git repository using the Python builder image:
The
python~prefix tells OpenShift which builder image to use. OpenShift can also auto-detect the language from the repository contents. -
Watch the build:
The build clones the repo, installs dependencies from
requirements.txt, and assembles the image. -
Expose the application:
-
Verify:
Deploy a Node.js Application¶
-
Create a namespace:
-
Deploy using the Node.js builder:
-
Watch the build and expose:
-
Verify:
Available Builder Images¶
List the builder images available in your cluster:
Common builders include:
| Builder | Language/Runtime |
|---|---|
python |
Python (Django, Flask) |
nodejs |
Node.js (Express, Next.js) |
java |
Java (Spring Boot, Quarkus) |
ruby |
Ruby (Rails, Sinatra) |
php |
PHP (Laravel, Symfony) |
dotnet |
.NET (ASP.NET Core) |
golang |
Go |
Trigger a Rebuild¶
After pushing code changes to the Git repository, trigger a new build:
OpenShift can also be configured with webhooks to trigger builds automatically on Git push.
What to Show in a Demo¶
- No Containerfile needed — the developer only provides source code
- Build logs show the entire process (clone, dependency install, image assembly)
- Internal registry — the built image is stored in the OpenShift registry automatically
- Instant rollout — a new deployment rolls out as soon as the image build completes
- Rebuild on code change —
oc start-buildor webhook triggers