Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Ubi9 multistage template #446

Open
wants to merge 2 commits into
base: ubi9
Choose a base branch
from

Conversation

jmtd
Copy link
Member

@jmtd jmtd commented Feb 13, 2024

WIP! TODO:

  • this is not a template!:
    • parameterize "quarkus-quickstarts"
    • parameterize "java-runtime" ?
    • route optional?
  • DeploymentConfig is deprecated; replace with Deployment
  • consider merging the phase-1 objects (oc new-app outputs) for a true one-shot

This is an attempt to capture all of the configuration for the second phase of a two-stage build: the first stage (not described) is a normal S2I-based build, and the second (this one) plucks the artifacts from the first phase and copies them into the runtime images.

The technique was described here: https://red.ht/lean-java-containers

The purpose of committing the template to the source repository is to help to ensure we maintain it and update it to prevent bit rot.

To use:

  1. Ensure your OpenShift instance has java ImageStreams. In particular the java-runtime imagestream, tag :latest.
    E.g., from the 'release'
oc create -f templates/community-image-streams.json
oc create -f templates/rutime-image-streams.json
  1. Define a new-app (oc new-app ...) based on a builder image. Care should be taken to align the JDK version in the builder with java-runtime:latest.

The build needs to output to the ImageStream "quarkus-quickstart" and must be a self-contained application within /deployments, and for which the run-java.sh script can correctly detect the start-up JAR.

E.g.

oc new-app --name=quarkus-quickstart \
    --image-stream=java:latest \
    --context-dir=getting-started \
    https://github.com/quarkusio/quarkus-quickstarts
  1. Load this template
oc create -f templates/multistage.yaml

These ImageStream definitions are very out-of-date. The "release"
branch contains the maintained ImageStreams. Remove these ones.

Signed-off-by: Jonathan Dowland <[email protected]>
This is an attempt to capture all of the configuration for the
second phase of a two-stage build: the first stage (not described)
is a normal S2I-based build, and the second (this one) plucks the
artifacts from the first phase and copies them into the runtime
images.

The technique was described here: <https://red.ht/lean-java-containers>

The purpose of committing the template to the source repository
is to help to ensure we maintain it and update it to prevent bit
rot.

To use:

1. Ensure your OpenShift instance has java ImageStreams. In
   particular the java-runtime imagestream, tag :latest.
   E.g., from the 'release' branch:

        oc create -f templates/community-image-streams.json
        oc create -f templates/rutime-image-streams.json

2. Define a new-app (oc new-app ...) based on a builder image.
   Care should be taken to align the JDK version in the builder
   with java-runtime:latest.

   The build needs to output to the ImageStream "quarkus-quickstart"
   and must be a self-contained application within /deployments,
   and for which the run-java.sh script can correctly detect the
   start-up JAR.

   E.g.

        oc new-app --name=quarkus-quickstart \
            --image-stream=java:latest \
            --context-dir=getting-started \
            https://github.com/quarkusio/quarkus-quickstarts

3. Load this template

        oc create -f templates/multistage.yaml

Signed-off-by: Jonathan Dowland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant