Build, Run, Deploy from Source

  • Get the source code for the spring-client app, and remove the Jenkinsfile from root,

$ git clone https://github.com/remkohdev/spring-client.git
$ cd spring-client
$ mkdir Jenkins
$ mv Jenkinsfile Jenkins
  • Download the builder image for Java,

  • You can use the private registry,

$ cd ~/dev/src/projects/spring-client
$ echo 'passw0rd' | docker login https://registry.redhat.io -u remkohdev --password-stdin
$ docker pull registry.redhat.com/redhat-openjdk-18/openjdk18-openshift
  • Or the public registry,

$ docker pull registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift
  • Build the image from source,

$ s2i build . registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift s2i-spring-client
$ docker images
REPOSITORY    TAG    IMAGE ID    CREATED    SIZE
s2i-spring-client    latest    4809340c9b4b    57 seconds ago    583MB
registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift   latest    74c8511ec481    5 weeks ago    480MB
  • Docker run the spring-client,

$ docker run -d -p 8080:8080 s2i-spring-client
  • Test,

$ newman run postman/springclient-test.postman_collection.json
  • Deploy to OpenShift,

$ oc project s2i-spring-client-ns
$ oc new-app --name springclient registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift~. --strategy=source --allow-missing-images --build-env='JAVA_APP_JAR=hello.jar'
$ oc expose svc/springclient
$ oc status

Last updated