$ podman inspect --format='{{ index .Config.Labels "io.openshift.s2i.scripts-url" }}' wildfly/wildfly-centos7
Customize source-to-image (S2I) builder images to modify the default assemble and run script behavior. You can adapt S2I builders to meet your specific application requirements when the default scripts are not suitable.
You invoke embedded S2I image scripts by creating wrapper scripts that run custom logic and default scripts. You must do this to extend builder image behavior while preserving supported script logic and upgrade compatibility.
Look at the value of the io.openshift.s2i.scripts-url label to determine the location of the scripts inside of the builder image:
$ podman inspect --format='{{ index .Config.Labels "io.openshift.s2i.scripts-url" }}' wildfly/wildfly-centos7
image:///usr/libexec/s2i
You inspected the wildfly/wildfly-centos7 builder image and found out that the scripts are in the /usr/libexec/s2i directory.
Create a script that includes an invocation of one of the standard scripts wrapped in other commands:
.s2i/bin/assemble script#!/bin/bash
echo "Before assembling"
/usr/libexec/s2i/assemble
rc=$?
if [ $rc -eq 0 ]; then
echo "After successful assembling"
else
echo "After failed assembling"
fi
exit $rc
This example shows a custom assemble script that prints the message, runs the standard assemble script from the image, and prints another message depending on the exit code of the assemble script.
|
When wrapping the run script, you must use |
.s2i/bin/run script#!/bin/bash
echo "Before running application"
exec /usr/libexec/s2i/run