---
title: "Deploy from Source Code (S2I)"
canonical: "https://kb.uconn.edu/space/IKB/28729573382/Deploy%20from%20Source%20Code%20(S2I)"
format: markdown
---
## What is Source-to-Image (S2I)?

OpenShift's **Source-to-Image (S2I)** process can build directly from a Git repository. It automatically detects the language and framework, builds the image, and deploys it.

| Language | Builder Image Example |
| --- | --- |
| **Python** | `python:3.11` |
| **Node.js** | `nodejs:18` |
| **Java** | `java:openjdk-17` |
| **Ruby** | `ruby:3.1` |
| **PHP** | `php:8.1` |
| **.NET** | `dotnet:7.0` |
| **Go** | `golang:1.20` |

> **Why use S2I?** You don't need to write a Dockerfile — OpenShift handles the build process automatically by detecting your project type.

---

## Deploy via Web Console

For a step-by-step walkthrough of deploying from source code via the web console, see the **Connecting a Bitbucket Repository to OpenShift** guide. That article covers the full "Import from Git" workflow including secret configuration for UConn's Bitbucket.

---

## Deploy via CLI

```shell
# Deploy from a Git repo (OpenShift auto-detects the language)
oc new-app https://github.com/your-org/your-app.git --name=my-app

# Specify a builder image explicitly
oc new-app python:3.11~https://github.com/your-org/your-app.git --name=my-app

# Watch the build
oc logs -f buildconfig/my-app

# Once the build completes, expose it
oc expose service/my-app

# Get the route URL
oc get route my-app
```

---

## Triggering Rebuilds

After pushing updates to your repository, trigger a new build:

```shell
# Trigger a manual rebuild
oc start-build my-app

# Build with local source code
oc start-build my-app --from-dir=.

# Watch build progress
oc logs -f build/my-app-2
```

---

## Build Strategies

| Strategy | Use Case | Command |
| --- | --- | --- |
| **S2I (Source)** | Build from Git repo | `oc new-app python:3.11~https://repo.git` |
| **Docker/Containerfile** | Custom Dockerfile in repo | `oc new-app https://repo.git --strategy=docker` |
| **Binary** | Upload local code | `oc start-build my-app --from-dir=.` |

---

> **Tip:** If OpenShift picks the wrong builder image, specify one explicitly using the `builder~repo` syntax shown above.

---

*UConn ITS Infrastructure Services — OpenShift Knowledge Base*