Unfound input from OpenShift EAP 7.3 artifact build output sourcePath

  docker, docker-image, jboss-eap-7, openshift, wildfly

Since JBoss EAP 7.3 OpenShift Images, it’s allow to chain application builds with a builder image and a small size runtime image.(chaining build is explained https://docs.openshift.com/container-platform/3.9/dev_guide/builds/advanced_build_operations.html#dev-guide-chaining-builds)

I tried with an example template from https://github.com/jboss-container-images/jboss-eap-7-openshift-image/blob/eap73/templates/eap73-openjdk11-basic-s2i.json. As you can see, there are two BuildConfig, one that produces the compiled server with artifact, and a second build that places that server with artifact in a separate image that runs the application.

But in my case (I followed steps from the official doc at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.3/html-single/getting_started_with_jboss_eap_for_openshift_container_platform/index#build_run_java_app_s2i), the second build with runtime image can’t find the server and artifact from previous build output.

My 1st artifact build is successful with this output:

[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ kitchensink ---
[INFO] Packaging webapp
[INFO] Assembling webapp [kitchensink] in [/tmp/src/target/kitchensink]
[INFO] Processing war project
[INFO] Copying webapp resources [/tmp/src/src/main/webapp]
[INFO] Webapp assembled in [395 msecs]
[INFO] Building war: /tmp/src/target/ROOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.897 s
[INFO] Finished at: 2020-11-19T04:10:31Z
[INFO] ------------------------------------------------------------------------
INFO Copying deployments from target to /deployments...
'/tmp/src/target/ROOT.war' -> '/deployments/ROOT.war'
INFO Copying server to /s2i-output
INFO Linking /opt/eap to /s2i-output
Pushing image docker-registry.default.svc:5000/test-project/eap-app-build-artifacts:latest ...
Pushed 3/4 layers, 76% complete
Pushed 4/4 layers, 100% complete
Push successful

The output seems fine as the artifact build is successful and the server with artifact was copied to /s2i-output directory, and the image was successfully pushed. However, the following 2nd runtime build can’t find the server with artifact to copy from last build. The Dockerfile source part in the 2nd build to copy the server and artifact is:

            "spec": {
                "output": {
                    "to": {
                        "kind": "ImageStreamTag",
                        "name": "${APPLICATION_NAME}:latest"
                    }
                },
                "source": {
                    "dockerfile": "FROM ${EAP_RUNTIME_IMAGE_NAME}nCOPY /server $JBOSS_HOMEnUSER rootnRUN chown -R jboss:root $JBOSS_HOME && chmod -R ug+rwX $JBOSS_HOMEnUSER jbossnCMD $JBOSS_HOME/bin/openshift-launch.sh",
                    "images": [
                        {
                            "from": {
                                "kind": "ImageStreamTag",
                                "name": "${APPLICATION_NAME}-build-artifacts:latest"
                            },
                            "paths": [
                                {
                                    "sourcePath": "/s2i-output/server/",
                                    "destinationDir": "."
                                }
                            ]
                        }
                    ]
                },
                "strategy": {
                    "dockerStrategy": {
                        "imageOptimizationPolicy": "SkipLayers",
                        "from": {
                            "kind": "ImageStreamTag",
                            "name": "${EAP_RUNTIME_IMAGE_NAME}",
                            "namespace": "${IMAGE_STREAM_NAMESPACE}"
                        }
                    },
                    "type": "Docker"
                },

it’s supposed to find and copy server + war from previous built image path /s2i-output/server/.

But the build log says "no such file or directory".

Pulling image "docker-registry.default.svc:5000/test-project/[email protected]:f8d488272ce1fe6b373182fae4b1062826981d84bda14b4b77c330a0e93ad99c" ...
Pulling image registry.redhat.io/jboss-eap-7/eap73-openjdk11-runtime-openshift-rhel8 ...
Pulled 2/3 layers, 72% complete
Pulled 3/3 layers, 100% complete
Extracting
Checking for Docker config file for PULL_DOCKERCFG_PATH in path /var/run/secrets/openshift.io/pull
Using Docker config file /var/run/secrets/openshift.io/pull/.dockerconfigjson
--> FROM registry.redhat.io/jboss-eap-7/eap73-openjdk11-runtime-openshift-rhel8
--> COPY /server $JBOSS_HOME
error: build error: stat /server: no such file or directory

Am I missing something here?

How can I inspect the content of the first artifact build image to verify the server + war are properly included in directory /s2i-output/server/ ?

Thanks.

Source: Docker Questions

LEAVE A COMMENT