Skip to content

Instantly share code, notes, and snippets.

@62mkv
Last active May 5, 2021 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 62mkv/7122f63d8ee4532a4180ddcc52f2346b to your computer and use it in GitHub Desktop.
Save 62mkv/7122f63d8ee4532a4180ddcc52f2346b to your computer and use it in GitHub Desktop.
OpenShift useful notes

Deploy an S2I-based application, based on Java 11, using custom output imagestream

Prepare "builder image"

First, we need to have a suitable (Java 11) builder image in our project

# pulling image locally
docker pull fabric8/s2i-java:latest-java11

# tagging image for OpenShift Registry
docker tag fabric8/s2i-java:latest-java11 docker-registry-default.apps.cluster1.my.org/cp-my-project/s2i-java:latest-java11

# authenticate in Docker with OpenShift Registry 
docker login -u my-user -p my-token docker-registry-default.apps.cluster1.my.org

# push builder image into (already existing) imagestream
docker push docker-registry-default.apps.cluster1.my.org/cp-my-project/s2i-java:latest-java11

Create build config as yaml file

oc new-app s2i-java:latest-java11~ssh://git@git.my.org/project/repo.git#feature/branch-name ^
   --dry-run ^
   --name=new-app-name-jh7 ^
   --source-secret=scmsecret ^
   --allow-missing-images ^
   --build-env-file=build-env-jh7.env ^
   -o yaml > jh7.yaml

Create an app (build config) from the yaml config

oc create -f jh7.jaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment