diff --git a/README.md b/README.md index 4ca6b49b7..0f5306347 100644 --- a/README.md +++ b/README.md @@ -37,17 +37,17 @@ COPY --chown=1001:0 server.xml /config/ # A sample is in the 'Getting Required Features' section below COPY --chown=1001:0 featureUtility.properties /opt/ol/wlp/etc/ -# This script will add the requested XML snippets to enable Liberty features and grow image to be fit-for-purpose using featureUtility. -# Only available in 'kernel-slim'. The 'full' tag already includes all features for convenience. -RUN features.sh - # Add interim fixes (optional) COPY --chown=1001:0 interim-fixes /opt/ol/fixes/ +# This script will add the requested XML snippets to enable Liberty features, grow image to be fit-for-purpose using featureUtility and apply any interim fixes. +# Only available in 'kernel-slim'. The 'full' tag already includes all features for convenience. +RUN features.sh + # Add app COPY --chown=1001:0 Sample1.war /config/dropins/ -# This script will add the requested server configurations, apply any interim fixes and populate caches to optimize runtime +# This script will add the requested server configurations and populate caches to optimize runtime RUN configure.sh ``` diff --git a/releases/latest/beta/helpers/build/configure.sh b/releases/latest/beta/helpers/build/configure.sh index 7a2eafe88..25ae0487d 100755 --- a/releases/latest/beta/helpers/build/configure.sh +++ b/releases/latest/beta/helpers/build/configure.sh @@ -1,12 +1,11 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail function main() { ##Define variables for XML snippets source and target paths - WLP_INSTALL_DIR=/opt/ol/wlp SHARED_CONFIG_DIR=${WLP_INSTALL_DIR}/usr/shared/config SHARED_RESOURCE_DIR=${WLP_INSTALL_DIR}/usr/shared/resources @@ -93,7 +92,7 @@ function main() { # Apply interim fixes found in /opt/ol/fixes # Fixes recommended by IBM, such as to resolve security vulnerabilities, are also included in /opt/ol/fixes # Note: This step should be done once needed features are enabled and installed. - find /opt/ol/fixes -type f -name "*.jar" -print0 | sort -z | xargs -0 -n 1 -r -I {} java -jar {} --installLocation $WLP_INSTALL_DIR + installFixes # Force the server.xml to be processed by updating its timestamp touch /config/server.xml diff --git a/releases/latest/beta/helpers/build/infinispan-client-setup.sh b/releases/latest/beta/helpers/build/infinispan-client-setup.sh index 05eebf61b..80cdd44da 100755 --- a/releases/latest/beta/helpers/build/infinispan-client-setup.sh +++ b/releases/latest/beta/helpers/build/infinispan-client-setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail diff --git a/releases/latest/beta/helpers/build/populate_scc.sh b/releases/latest/beta/helpers/build/populate_scc.sh index b193cefe7..923f72400 100755 --- a/releases/latest/beta/helpers/build/populate_scc.sh +++ b/releases/latest/beta/helpers/build/populate_scc.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail diff --git a/releases/latest/full/helpers/build/configure.sh b/releases/latest/full/helpers/build/configure.sh index 7a2eafe88..25ae0487d 100755 --- a/releases/latest/full/helpers/build/configure.sh +++ b/releases/latest/full/helpers/build/configure.sh @@ -1,12 +1,11 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail function main() { ##Define variables for XML snippets source and target paths - WLP_INSTALL_DIR=/opt/ol/wlp SHARED_CONFIG_DIR=${WLP_INSTALL_DIR}/usr/shared/config SHARED_RESOURCE_DIR=${WLP_INSTALL_DIR}/usr/shared/resources @@ -93,7 +92,7 @@ function main() { # Apply interim fixes found in /opt/ol/fixes # Fixes recommended by IBM, such as to resolve security vulnerabilities, are also included in /opt/ol/fixes # Note: This step should be done once needed features are enabled and installed. - find /opt/ol/fixes -type f -name "*.jar" -print0 | sort -z | xargs -0 -n 1 -r -I {} java -jar {} --installLocation $WLP_INSTALL_DIR + installFixes # Force the server.xml to be processed by updating its timestamp touch /config/server.xml diff --git a/releases/latest/full/helpers/build/infinispan-client-setup.sh b/releases/latest/full/helpers/build/infinispan-client-setup.sh index 05eebf61b..80cdd44da 100755 --- a/releases/latest/full/helpers/build/infinispan-client-setup.sh +++ b/releases/latest/full/helpers/build/infinispan-client-setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail diff --git a/releases/latest/full/helpers/build/populate_scc.sh b/releases/latest/full/helpers/build/populate_scc.sh index b193cefe7..923f72400 100755 --- a/releases/latest/full/helpers/build/populate_scc.sh +++ b/releases/latest/full/helpers/build/populate_scc.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail diff --git a/releases/latest/kernel-slim/helpers/build/configure.sh b/releases/latest/kernel-slim/helpers/build/configure.sh index ea43983b6..5349d1d3c 100755 --- a/releases/latest/kernel-slim/helpers/build/configure.sh +++ b/releases/latest/kernel-slim/helpers/build/configure.sh @@ -1,12 +1,11 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail function main() { ##Define variables for XML snippets source and target paths - WLP_INSTALL_DIR=/opt/ol/wlp SHARED_CONFIG_DIR=${WLP_INSTALL_DIR}/usr/shared/config SHARED_RESOURCE_DIR=${WLP_INSTALL_DIR}/usr/shared/resources @@ -52,7 +51,7 @@ function main() { # Apply interim fixes found in /opt/ol/fixes # Fixes recommended by IBM, such as to resolve security vulnerabilities, are also included in /opt/ol/fixes # Note: This step should only be done ONCE needed features are enabled and installed. - find /opt/ol/fixes -type f -name "*.jar" -print0 | sort -z | xargs -0 -n 1 -r -I {} java -jar {} --installLocation $WLP_INSTALL_DIR + installFixes # Force the server.xml to be processed by updating its timestamp touch /config/server.xml @@ -80,6 +79,8 @@ function main() { fi eval $cmd fi + + removeBuildArtifacts } ## parse provider list to generate files into configDropins diff --git a/releases/latest/kernel-slim/helpers/build/features.sh b/releases/latest/kernel-slim/helpers/build/features.sh index 180be0c5c..83ce438d1 100755 --- a/releases/latest/kernel-slim/helpers/build/features.sh +++ b/releases/latest/kernel-slim/helpers/build/features.sh @@ -1,6 +1,6 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail @@ -31,3 +31,8 @@ fi featureUtility installServerFeatures --acceptLicense defaultServer --noCache find /opt/ol/wlp/lib /opt/ol/wlp/bin ! -perm -g=rw -print0 | xargs -0 -r chmod g+rw +# Apply interim fixes found in /opt/ol/fixes +# Fixes recommended by IBM, such as to resolve security vulnerabilities, are also included in /opt/ol/fixes +# Note: This step should only be done ONCE needed features are enabled and installed. +installFixes + diff --git a/releases/latest/kernel-slim/helpers/build/infinispan-client-setup.sh b/releases/latest/kernel-slim/helpers/build/infinispan-client-setup.sh index 05eebf61b..80cdd44da 100755 --- a/releases/latest/kernel-slim/helpers/build/infinispan-client-setup.sh +++ b/releases/latest/kernel-slim/helpers/build/infinispan-client-setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail diff --git a/releases/latest/kernel-slim/helpers/build/internal/logger.sh b/releases/latest/kernel-slim/helpers/build/internal/logger.sh deleted file mode 100755 index 9d27be63d..000000000 --- a/releases/latest/kernel-slim/helpers/build/internal/logger.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -function main() { - if [ "$VERBOSE" != "true" ]; then - exec >/dev/null - fi -} - -function hideLogs() { - exec 3>&1 >/dev/null 4>&2 2>/dev/null -} - -function showLogs() { - exec 1>&3 3>&- 2>&4 4>&- -} - -main \ No newline at end of file diff --git a/releases/latest/kernel-slim/helpers/build/internal/utils.sh b/releases/latest/kernel-slim/helpers/build/internal/utils.sh new file mode 100755 index 000000000..9c26df06e --- /dev/null +++ b/releases/latest/kernel-slim/helpers/build/internal/utils.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function main() { + WLP_TYPE=ol + WLP_INSTALL_DIR=/opt/$WLP_TYPE/wlp + if [ "$VERBOSE" != "true" ]; then + exec >/dev/null + fi +} + +function hideLogs() { + exec 3>&1 >/dev/null 4>&2 2>/dev/null +} + +function showLogs() { + exec 1>&3 3>&- 2>&4 4>&- +} + +function installFixes() { + if [ ! -f "/logs/fixes.log" ] && ls "/opt/$WLP_TYPE/fixes"/*.jar 1> /dev/null 2>&1; then + find /opt/$WLP_TYPE/fixes -type f -name "*.jar" -print0 | sort -z | xargs -0 -n 1 -r -I {} java -jar {} --installLocation $WLP_INSTALL_DIR + echo "installFixes has been run successfully" > /logs/fixes.log + fi +} + +function removeBuildArtifacts() { + rm -f /logs/fixes.log +} + +main \ No newline at end of file diff --git a/releases/latest/kernel-slim/helpers/build/populate_scc.sh b/releases/latest/kernel-slim/helpers/build/populate_scc.sh index b193cefe7..923f72400 100755 --- a/releases/latest/kernel-slim/helpers/build/populate_scc.sh +++ b/releases/latest/kernel-slim/helpers/build/populate_scc.sh @@ -1,5 +1,5 @@ #!/bin/bash -. /opt/ol/helpers/build/internal/logger.sh +. /opt/ol/helpers/build/internal/utils.sh set -Eeox pipefail