From f5e67cf1e161fd65cc779c52997018215a931a05 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 10 Feb 2025 12:50:35 +0100 Subject: [PATCH 1/2] Use python 3.12 in the nodejs 22 container for native extensions. A nodejs tool "node-gyp" used for compiling native extensions from npm from source requires python version >= 3.8. Install the high-enough python version 3.12 for RHEL 8 container. RHEL 8 base version is 3.6, it is not enough for node-gyp. Python 3.12 in RHEL 8 has support until 2029, the currently projected RHEL 8 EOL, similarly to python 3.6 nodejs-22-minimal container does not do anything with python, leave that Containerfile as-is. --- 22/Dockerfile.rhel8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/22/Dockerfile.rhel8 b/22/Dockerfile.rhel8 index 15d4896e..d6b93c04 100644 --- a/22/Dockerfile.rhel8 +++ b/22/Dockerfile.rhel8 @@ -54,10 +54,9 @@ LABEL summary="$SUMMARY" \ usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel python3.12" && \ INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper-libs which" && \ ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ - ln -s /usr/libexec/platform-python /usr/bin/python3 && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ From 1c7788eb83ce9da68d231f7ea694e154f8db1c97 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 25 Feb 2025 15:28:09 +0100 Subject: [PATCH 2/2] Require gcc-toolset-14 for nodejs-22 container. Node.js 22's minimal GCC requirement is higher than the default GCC and GCC-C++ available on RHEL 8. It is reasonable from npm module developers to expect at least the minimal version node.js supports for compilation will be available to also compile the native extension from source. Therefore use and enable the gcc-toolset-14 collection inside container. --- 22/Dockerfile.rhel8 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/22/Dockerfile.rhel8 b/22/Dockerfile.rhel8 index d6b93c04..5c214d01 100644 --- a/22/Dockerfile.rhel8 +++ b/22/Dockerfile.rhel8 @@ -54,7 +54,8 @@ LABEL summary="$SUMMARY" \ usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel python3.12" && \ + MODULE_DEPS="make gcc-toolset-14-gcc gcc-toolset-14-gcc-c++ gcc-toolset-14-runtime \ + libatomic_ops git openssl-devel python3.12" && \ INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper-libs which" && \ ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ @@ -75,5 +76,10 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 +# Enable the SCL for all bash scripts. +ENV BASH_ENV=/opt/rh/gcc-toolset-14/enable \ + ENV=/opt/rh/gcc-toolset-14/enable \ + PROMPT_COMMAND=". /opt/rh/gcc-toolset-14/enable" + # Set the default CMD to print the usage of the language image CMD $STI_SCRIPTS_PATH/usage