Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

OpenShift BuildConfig Tutorial

โœ… What is OpenShift BuildConfig?

BuildConfig in OpenShift is a Kubernetes-native custom resource provided by OpenShift that defines how to build a container image from source code. It automates the end-to-end image build process โ€” from fetching source code to producing and storing container images โ€” using build strategies like Source-to-Image (S2I), Docker, or custom workflows.


๐Ÿ“˜ BuildConfig Definition

A BuildConfig is a declarative configuration object in OpenShift that defines the strategy, source, triggers, and output for building container images automatically or on-demand.

Itโ€™s like a recipe for converting application source code into a deployable container image.


โญ Key Features of BuildConfig

FeatureDescription
๐ŸŽฏ Multiple Build StrategiesSupports S2I, Dockerfile, and Custom strategies.
๐Ÿ”— Git IntegrationPulls source code directly from public/private Git repositories.
๐Ÿ” Automatic TriggersRebuilds can be triggered by Git changes, image changes, or config changes.
๐Ÿ›  Custom Build EnvironmentSupports environment variables, secrets, and configmaps during builds.
๐Ÿท๏ธ ImageStream IntegrationBuilt images can be pushed to internal ImageStreams or external registries.
๐Ÿ‘ฅ WebhooksAllows GitHub/GitLab to trigger builds via webhooks.
๐Ÿ” Build Logs & HistoryEasily view build logs, status, and retry failed builds.
๐Ÿ” Secure Build ContextsSupports source credentials, secrets, and isolated build pods.

๐Ÿ”ง Example Use Cases

ScenarioHow BuildConfig Helps
CI/CD automationAuto-rebuild on Git push or base image update
DevOps in hybrid cloudWorks with internal and external image registries
Compliance & traceabilityFull build history and image tracking
S2I app deployment (Node.js, Python, etc.)Uses language-specific builder images

๐Ÿ“ฆ BuildConfig vs Dockerfile vs Pipelines

Tool/ConceptRole
BuildConfigDefines how to build an image from source
DockerfileManual build instructions (used in Docker strategy)
PipelinesOrchestrates multiple stages/jobs (Tekton-based)

๐Ÿš€ BuildConfig Lifecycle

  1. Developer pushes code to Git
  2. OpenShift triggers a build (via webhook or manually)
  3. Code is fetched and built using specified strategy
  4. Final image is stored (ImageStream or registry)
  5. App is deployed or updated automatically

โœ… Works on OpenShift 4.13+ (including Azure Red Hat OpenShift)


๐ŸŽฏ Goal

Build a Node.js application using:

  • โœ… Git source
  • โœ… External Red Hat base image (ubi8/nodejs-16)
  • โœ… OpenShift S2I strategy (using DockerImage)
  • โœ… No need for preloaded ImageStreams

๐Ÿงฑ Prerequisites

RequirementDetails
OpenShift clusterAccess to 4.13+ (Azure, local, etc.)
Project createdUse oc new-project or create via Web UI
GitHub repo with app codee.g., sclorg/nodejs-ex
OpenShift CLI (optional)oc logged in

๐Ÿงพ Option 1: YAML Method (CLI or Web Console YAML Editor)

โœ… Step-by-Step (Using YAML)

  1. Create/Open a project oc new-project nodejs-s2i-demo
  2. Apply this working BuildConfig YAML:
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: nodejs-sample-build
  labels:
    app: nodejs-sample
spec:
  source:
    type: Git
    git:
      uri: https://github.com/sclorg/nodejs-ex.git
      ref: main
    contextDir: .
  strategy:
    type: Source
    sourceStrategy:
      from:
        kind: DockerImage
        name: registry.access.redhat.com/ubi8/nodejs-16
      forcePull: true
  output:
    to:
      kind: ImageStreamTag
      name: nodejs-sample:latest
  triggers:
    - type: ConfigChange
    - type: ImageChange
  runPolicy: Serial
Code language: JavaScript (javascript)
  1. Start the build manually: oc start-build nodejs-sample-build --follow
  2. Deploy the built image: oc new-app nodejs-sample oc expose svc/nodejs-sample
  3. Access the app: oc get route

๐Ÿ–ฑ๏ธ Option 2: Using the OpenShift Developer Console UI

Based on your screenshots โ€” modern and guided flow

โœ… Step-by-Step (Using Developer Web Console)

  1. Go to Developer โ†’ +Add โ†’ From Git
  2. Fill Git Repository info:
    • Git Repo URL: https://github.com/sclorg/nodejs-ex.git
    • Git Reference: main (or leave blank)
    • Context Dir: .
  3. Builder Image Selection (Build from):
    • Select โ€œDocker Imageโ€ from the build option dropdown
    • Input Docker Image: registry.access.redhat.com/ubi8/nodejs-16
  4. Deployment Settings:
    • App Name: nodejs-sample
    • Resources: Deployment (leave default)
    • Create Route: โœ… (enabled)
  5. Click “Create”

OpenShift will:

  • Create BuildConfig, ImageStream, Deployment, and Route
  • Trigger an initial build
  • Watch progress from Builds or Topology

๐Ÿงช How to Monitor

  • Build logs:
    Developer โ†’ Builds โ†’ nodejs-sample-build โ†’ View Logs
  • Application route:
    Developer โ†’ Topology โ†’ Click route link
  • BuildConfig YAML:
    Admin โ†’ Builds โ†’ nodejs-sample-build โ†’ YAML

๐Ÿ” Updating Code

Just push code to GitHub and trigger a build manually:

oc start-build nodejs-sample-build

Or setup GitHub webhook using:

oc describe bc nodejs-sample-build

โœ… Summary

StepUI PathYAML Equivalent
Git sourceFrom Gitsource.git.uri
Docker imageSelect โ€œDocker Imageโ€strategy.sourceStrategy.from.kind: DockerImage
DeploymentAuto-created via +AddUse oc new-app after build manually
RouteEnabled in UIoc expose svc/nodejs-sample

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

List of all Job Roles, Job Titles in Software and IT Companies

The software and IT industry is home to a diverse array of job roles and titles, reflecting the dynamic and ever-evolving nature of technology. From core technical…

Read More

Best DevOps Tools in 2024

hereโ€™s a clear, structured breakdown of the Best DevOps Tools (grouped by categories), so you can use it for learning, training, or posts. ๐Ÿš€ Best DevOps Tools…

Read More

OpenShift Install & Configurations using OpenShift Local in windows laptops/desktops

Below is the 100% correct and updated step-by-step guide to install and configure OpenShift Local (aka CRC) on Windows 10/11 laptops or desktops using the correct crc…

Read More

Openshift: How to configure Azure openshift ARO with Custom Domain

Step-by-Step Guide: Configuring Azure Red Hat OpenShift (ARO) with a Custom Domain Setting up a custom domain for your ARO cluster involves both Azure and DNS provider…

Read More

Openshift: Lab 10 – View performance information using the OpenShift web console

Rajesh Kumar Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at…

Read More

Openshift: How to add Helm Repository in Openshift

Adding a Helm repository in OpenShift is a common step to manage and deploy Helm charts in your OpenShift cluster. OpenShift supports Helm CLI out of the…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x