Skip to content

Commit

Permalink
[KOGITO-162] - Migrate the Kogito base images from centos to ubi8
Browse files Browse the repository at this point in the history
Signed-off-by: Filippe Spolti <fspolti@redhat.com>
  • Loading branch information
spolti committed Aug 16, 2019
1 parent adc1667 commit 2df93b9
Show file tree
Hide file tree
Showing 48 changed files with 129 additions and 104 deletions.
50 changes: 25 additions & 25 deletions s2i/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@ BUILD_ENGINE := docker

# Build all images
.PHONY: build
build: kogito-quarkus-centos kogito-quarkus-centos-s2i kogito-springboot-centos kogito-springboot-centos-s2i
build: kogito-quarkus-ubi8 kogito-quarkus-ubi8-s2i kogito-springboot-ubi8 kogito-springboot-ubi8-s2i

kogito-quarkus-centos:
cekit -v build --overrides-file kogito-quarkus-centos-overrides.yaml ${BUILD_ENGINE}
kogito-quarkus-ubi8:
cekit -v build --overrides-file kogito-quarkus-ubi8-overrides.yaml ${BUILD_ENGINE}

kogito-quarkus-centos-s2i:
cekit -v build --overrides-file kogito-quarkus-centos-s2i-overrides.yaml ${BUILD_ENGINE}
kogito-quarkus-ubi8-s2i:
cekit -v build --overrides-file kogito-quarkus-ubi8-s2i-overrides.yaml ${BUILD_ENGINE}

kogito-springboot-centos:
cekit -v build --overrides-file kogito-springboot-centos-overrides.yaml ${BUILD_ENGINE}
kogito-springboot-ubi8:
cekit -v build --overrides-file kogito-springboot-ubi8-overrides.yaml ${BUILD_ENGINE}

kogito-springboot-centos-s2i:
cekit -v build --overrides-file kogito-springboot-centos-s2i-overrides.yaml ${BUILD_ENGINE}
kogito-springboot-ubi8-s2i:
cekit -v build --overrides-file kogito-springboot-ubi8-s2i-overrides.yaml ${BUILD_ENGINE}


# Build and test all images
.PHONY: test
test:
cekit -v build --overrides-file kogito-quarkus-centos-overrides.yaml --overrides 'name: kogito-quarkus-centos-candidate' docker --no-squash
modules/kogito-quarkus-centos/test/run
cekit -v build --overrides-file kogito-quarkus-centos-s2i-overrides.yaml --overrides 'name: kogito-quarkus-centos-s2i-candidate' docker --no-squash
modules/kogito-quarkus-centos-s2i/test/run
cekit -v build --overrides-file kogito-springboot-centos-overrides.yaml --overrides 'name: kogito-springboot-centos-candidate' docker --no-squash
modules/kogito-springboot-centos/test/run
cekit -v build --overrides-file kogito-springboot-centos-s2i-overrides.yaml --overrides 'name: kogito-springboot-centos-s2i-candidate' docker --no-squash
modules/kogito-springboot-centos-s2i-/test/run
cekit -v build --overrides-file kogito-quarkus-ubi8-overrides.yaml --overrides 'name: kogito-quarkus-ubi8-candidate' docker --no-squash
modules/kogito-quarkus-ubi8/test/run
cekit -v build --overrides-file kogito-quarkus-ubi8-s2i-overrides.yaml --overrides 'name: kogito-quarkus-ubi8-s2i-candidate' docker --no-squash
modules/kogito-quarkus-ubi8-s2i/test/run
cekit -v build --overrides-file kogito-springboot-ubi8-overrides.yaml --overrides 'name: kogito-springboot-ubi8-candidate' docker --no-squash
modules/kogito-springboot-ubi8/test/run
cekit -v build --overrides-file kogito-springboot-ubi8-s2i-overrides.yaml --overrides 'name: kogito-springboot-ubi8-s2i-candidate' docker --no-squash
modules/kogito-springboot-ubi8-s2i-/test/run


# push images to quay.io, this requires permissions under kiegroup organization
.PHONY: push
push: build _push
_push:
docker push quay.io/kiegroup/kogito-quarkus-centos:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-centos:latest
docker push quay.io/kiegroup/kogito-quarkus-centos-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-centos-s2i:latest
docker push quay.io/kiegroup/kogito-springboot-centos:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-centos:latest
docker push quay.io/kiegroup/kogito-springboot-centos-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-centos-s2i:latest
docker push quay.io/kiegroup/kogito-quarkus-ubi8:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-ubi8:latest
docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:latest
docker push quay.io/kiegroup/kogito-springboot-ubi8:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8:latest
docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:latest
33 changes: 16 additions & 17 deletions s2i/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,49 @@ of builder images to perform the build and to run the result binaries.

Images are grouped by the runtime that will run the binaries and the OS level

## Centos 7

## Quarkus

### kogito-quarkus-centos-s2i
### kogito-quarkus-ubi8-s2i

Builder image that is responsible for building the project
with Apache Maven and generate native image using GraalVM/SubstrateVM

Image location: quay.io/kiegroup/kogito-quarkus-centos-s2i:latest
Image location: quay.io/kiegroup/kogito-quarkus-ubi8-s2i:latest

For more details have a look at [README.md](modules/kogito-quarkus-centos-s2i/README.md)
For more details have a look at [README.md](modules/kogito-quarkus-ubi8-s2i/README.md)

### kogito-quarkus-centos
### kogito-quarkus-ubi8

Runtime image that is responsible for just running the binaries taken from the
builder image. That approach is giving small and compact image that does not
not carry on any of the build tools or artefacts (like local maven repository).

Image location: quay.io/kiegroup/kogito-quarkus-centos:latest
Image location: quay.io/kiegroup/kogito-quarkus-ubi8:latest

For more details have a look at [README.md](kogito-quarkus-centos/README.md)
For more details have a look at [README.md](kogito-quarkus-ubi8/README.md)

## SpringBoot

### kogito-springboot-centos-s2i
### kogito-springboot-ubi8-s2i

Builder image that is responsible for building the project
with Apache Maven and generate fat jar.

Image location: quay.io/kiegroup/kogito-springboot-centos-s2i:latest
Image location: quay.io/kiegroup/kogito-springboot-ubi8-s2i:latest

For more details have a look at [README.md](kogito-springboot-centos-s2i/README.md)
For more details have a look at [README.md](kogito-springboot-ubi8-s2i/README.md)

### kogito-springboot-centos
### kogito-springboot-ubi8

Runtime image that is responsible for just running the fat jar taken from the
builder image. It has JRE installed on the container to allow java executable.
That approach is giving small and compact image that does not
not carry on any of the build tools or artefacts (like local maven repository).

Image location: quay.io/kiegroup/kogito-springboot-centos:latest
Image location: quay.io/kiegroup/kogito-springboot-ubi8:latest

For more details have a look at [README.md](kogito-springboot-centos/README.md)
For more details have a look at [README.md](kogito-springboot-ubi8/README.md)

# Supported source structure

Expand Down Expand Up @@ -88,7 +87,7 @@ Best way is to use maven archetypes to generate project structure (same archetyp
Once the images are built and imported into registry (docker hub or internal OpenShift registry)
new applications can be build and deployed with this few steps

`oc new-build quay.io/kiegroup/kogito-quarkus-centos-s2i~https://github.com/user/project --name=builder-app-name`
`oc new-build quay.io/kiegroup/kogito-quarkus-ubi8-s2i~https://github.com/user/project --name=builder-app-name`

Modify accordingly following
- repository is the docker repository the images are available in (could be OpenShift project or docker hub user)
Expand All @@ -100,7 +99,7 @@ Modify accordingly following

Once the build is finished, create another build config to produce runtime image

`oc new-build --name app-name --source-image=builder-app-name --source-image-path=/home/kogito/bin:. --image-stream=kogito-quarkus-centos`
`oc new-build --name app-name --source-image=builder-app-name --source-image-path=/home/kogito/bin:. --image-stream=kogito-quarkus-ubi8`

Modify accordingly following
- app-name is the final name of the image that will be deployed
Expand Down Expand Up @@ -171,7 +170,7 @@ $ make

To build a single image, use `make build image-name`, example:
```bash
$ make kogito-quarkus-centos
$ make kogito-quarkus-ubi8
```

Testing the images (WIP):
Expand Down Expand Up @@ -204,7 +203,7 @@ $ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)

Tag the built image, example
```bash
$ docker tag {IMAGE_ID} $(minishift openshift registry)/{PROJECT}/kogito-quarkus-centos
$ docker tag {IMAGE_ID} $(minishift openshift registry)/{PROJECT}/kogito-quarkus-ubi8
```

Modify accordingly
Expand Down
8 changes: 3 additions & 5 deletions s2i/image.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
schema_version: 1

name: "kogito-image-real-name-on-overrides-file"
version: "0.2.0"
from: "centos:latest"
version: "0.3.0"
from: "registry.redhat.io/ubi8-minimal:latest"

labels:
- name: "maintainer"
Expand All @@ -19,9 +19,7 @@ modules:
- path: modules

packages:
repositories:
- name: scl
rpm: centos-release-scl
manager: microdnf

run:
user: 1001
Expand Down
32 changes: 16 additions & 16 deletions s2i/kogito-imagestream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,84 +9,84 @@ items:
- kind: ImageStream
apiVersion: v1
metadata:
name: kogito-quarkus-centos
name: kogito-quarkus-ubi8
annotations:
openshift.io/display-name: Runtime image for Kogito based on Quarkus native image
openshift.io/provider-display-name: Kie Group.
spec:
tags:
- name: '0.2.0'
- name: '0.3.0'
annotations:
description: Runtime image for Kogito based on Quarkus native image
iconClass: icon-jbpm
tags: builder,runtime,kogito,quarkus
supports: quarkus
version: '0.2.0'
version: '0.3.0'
referencePolicy:
type: Local
from:
kind: DockerImage
name: quay.io/kiegroup/kogito-quarkus-centos:0.2.0
name: quay.io/kiegroup/kogito-quarkus-ubi8:0.3.0
- kind: ImageStream
apiVersion: v1
metadata:
name: kogito-quarkus-centos-s2i
name: kogito-quarkus-ubi8-s2i
annotations:
openshift.io/display-name: Platform for building Kogito based on Quarkus
openshift.io/provider-display-name: Kie Group.
spec:
tags:
- name: '0.2.0'
- name: '0.3.0'
annotations:
description: Platform for building Kogito based on Quarkus
iconClass: icon-jbpm
tags: builder,kogito,quarkus
supports: quarkus
version: '0.2.0'
version: '0.3.0'
referencePolicy:
type: Local
from:
kind: DockerImage
name: quay.io/kiegroup/kogito-quarkus-centos-s2i:0.2.0
name: quay.io/kiegroup/kogito-quarkus-ubi8-s2i:0.3.0
- kind: ImageStream
apiVersion: v1
metadata:
name: kogito-springboot-centos
name: kogito-springboot-ubi8
annotations:
openshift.io/display-name: Runtime image for Kogito based on SpringBoot native image
openshift.io/provider-display-name: Kie Group.
spec:
tags:
- name: '0.2.0'
- name: '0.3.0'
annotations:
description: Platform for building Kogito based on Quarkus
iconClass: icon-jbpm
tags: builder,runtime,kogito,springboot
supports: springboot
version: '0.2.0'
version: '0.3.0'
referencePolicy:
type: Local
from:
kind: DockerImage
name: quay.io/kiegroup/kogito-springboot-centos:0.2.0
name: quay.io/kiegroup/kogito-springboot-ubi8:0.3.0
- kind: ImageStream
apiVersion: v1
metadata:
name: kogito-springboot-centos-s2i
name: kogito-springboot-ubi8-s2i
annotations:
openshift.io/display-name: Platform for building Kogito based on SpringBoot
openshift.io/provider-display-name: Kie Group.
spec:
tags:
- name: '0.2.0'
- name: '0.3.0'
annotations:
description: Platform for building Kogito based on Quarkus
iconClass: icon-jbpm
tags: builder,kogito,springboot
supports: springboot
version: '0.2.0'
version: '0.3.0'
referencePolicy:
type: Local
from:
kind: DockerImage
name: quay.io/kiegroup/kogito-springboot-centos-s2i:0.2.0
name: quay.io/kiegroup/kogito-springboot-ubi8-s2i:0.3.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 1

name: "quay.io/kiegroup/kogito-quarkus-centos"
name: "quay.io/kiegroup/kogito-quarkus-ubi8"
description: "Runtime image for Kogito based on Quarkus native image"

labels:
Expand All @@ -16,5 +16,6 @@ ports:

modules:
install:
- name: install-rpm-dependencies
- name: add-kogito-user
- name: kogito-quarkus-centos
- name: kogito-quarkus-ubi8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 1

name: "quay.io/kiegroup/kogito-quarkus-centos-s2i"
name: "quay.io/kiegroup/kogito-quarkus-ubi8-s2i"
description: "Platform for building Kogito based on Quarkus"

labels:
Expand All @@ -13,12 +13,13 @@ labels:

modules:
install:
- name: install-rpm-dependencies
- name: add-kogito-user
- name: graalvm
version: "19.0.2"
- name: maven
version: "3.6.0"
- name: kogito-quarkus-centos-s2i
- name: kogito-quarkus-ubi8-s2i

packages:
install:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 1

name: "quay.io/kiegroup/kogito-springboot-centos"
name: "quay.io/kiegroup/kogito-springboot-ubi8"
description: "Runtime image for Kogito based on SpringBoot native image"

labels:
Expand All @@ -16,7 +16,8 @@ ports:

modules:
install:
- name: install-rpm-dependencies
- name: add-kogito-user
- name: java-openjdk
version: "1.8.0"
- name: kogito-springboot-centos
- name: kogito-springboot-ubi8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 1

name: "quay.io/kiegroup/kogito-springboot-centos-s2i"
name: "quay.io/kiegroup/kogito-springboot-ubi8-s2i"
description: "Platform for building Kogito based on SpringBoot"

labels:
Expand All @@ -13,9 +13,10 @@ labels:

modules:
install:
- name: install-rpm-dependencies
- name: add-kogito-user
- name: maven
version: "3.6.0"
- name: java-openjdk
version: "1.8.0"
- name: kogito-springboot-centos-s2i
- name: kogito-springboot-ubi8-s2i
3 changes: 3 additions & 0 deletions s2i/modules/add-kogito-user/module.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
schema_version: 1
version: "0.3.0"

name: add-kogito-user
execute:
- script: add-user

envs:
- name: "KOGITO_HOME"
value: "/home/kogito"

4 changes: 4 additions & 0 deletions s2i/modules/install-rpm-dependencies/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

microdnf clean all
rm -rf /var/cache/yum
13 changes: 13 additions & 0 deletions s2i/modules/install-rpm-dependencies/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
schema_version: 1
name: install-rpm-dependencies

execute:
- script: clean.sh

# holds common dependencies across images
packages:
install:
- shadow-utils
- tar
- gzip

0 comments on commit 2df93b9

Please sign in to comment.