From 07748939abeb258e180ae9fb6cf332dc5c321630 Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Wed, 22 Apr 2026 11:34:13 +0200 Subject: [PATCH 1/9] Draft dist-gen. --- manifest.yml | 91 ++++++++++++++++++++++++++++++++ specs/multispec.yml | 118 ++++++++++++++++++++++++++++++++++++++++++ src/Dockerfile | 89 +++++++++++++++++++++++++++++++ src/Dockerfile.fedora | 74 ++++++++++++++++++++++++++ 4 files changed, 372 insertions(+) create mode 100644 manifest.yml create mode 100644 specs/multispec.yml create mode 100644 src/Dockerfile create mode 100644 src/Dockerfile.fedora diff --git a/manifest.yml b/manifest.yml new file mode 100644 index 00000000..a411a86f --- /dev/null +++ b/manifest.yml @@ -0,0 +1,91 @@ +# Manifest for image directories creation +# every dest path will be prefixed by $DESTDIR/$version + +# Files containing distgen directives +DISTGEN_RULES: + - src: src/root/usr/share/container-scripts/nodejs/README.md + dest: root/usr/share/container-scripts/nodejs/README.md + + - src: src/root/usr/share/container-scripts/nodejs/common.sh + dest: root/usr/share/container-scripts/nodejs/common.sh + + - src: src/root/usr/bin/run-nodejs-slave + dest: root/usr/bin/run-nodejs-slave + mode: "0755" + + - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-recovery.conf.template + dest: root/usr/share/container-scripts/nodejs/openshift-custom-recovery.conf.template + + - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-postgresql-replication.conf.template + dest: root/usr/share/container-scripts/nodejs/openshift-custom-postgresql-replication.conf.template + +# Files containing distgen directives, which are used for each +# (distro, version) combination not excluded in multispec +DISTGEN_MULTI_RULES: + - src: src/Dockerfile + dest: Dockerfile.rhel8 + + - src: src/Dockerfile + dest: Dockerfile.rhel9 + + - src: src/Dockerfile + dest: Dockerfile.rhel10 + + - src: src/Dockerfile + dest: Dockerfile.c9s + + - src: src/Dockerfile + dest: Dockerfile.c10s + + - src: src/Dockerfile.fedora + dest: Dockerfile.fedora + +# Files to copy +COPY_RULES: + - src: src/root/usr/libexec/fix-permissions + dest: root/usr/libexec/fix-permissions + mode: "0755" + + - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-postgresql.conf.template + dest: root/usr/share/container-scripts/nodejs/openshift-custom-postgresql.conf.template + + - src: src/root/usr/bin/run-nodejs + dest: root/usr/bin/run-nodejs + mode: "0755" + + - src: src/root/usr/bin/run-nodejs-master + dest: root/usr/bin/run-nodejs-master + mode: "0755" + + - src: src/root/usr/bin/container-entrypoint + dest: root/usr/bin/container-entrypoint + mode: "0755" + + - src: src/root/usr/bin/usage + dest: root/usr/bin/usage + mode: "0755" + + - src: src/root/usr/libexec/check-container + dest: root/usr/libexec/check-container + mode: "0755" + + - src: src/root/usr/share/container-scripts/nodejs/start/set_passwords.sh + dest: root/usr/share/container-scripts/nodejs/start/set_passwords.sh + + - src: src/s2i/bin/assemble + dest: s2i/bin/assemble + mode: "0755" + + - src: src/s2i/bin/usage + dest: s2i/bin/usage + mode: "0755" + +# Symbolic links +# This section is the last one on purpose because the generator.py +# does not allow dead symlinks. +SYMLINK_RULES: + - src: root/usr/share/container-scripts/nodejs/README.md + dest: README.md + + - src: ../test + dest: test diff --git a/specs/multispec.yml b/specs/multispec.yml new file mode 100644 index 00000000..53056955 --- /dev/null +++ b/specs/multispec.yml @@ -0,0 +1,118 @@ +version: 1 + +specs: + distroinfo: + fedora43: + distros: + - fedora-43-x86_64 + s2i_base: quay.io/fedora/s2i-core + org: "fedora" + prod: "fedora" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + + rhel8: + distros: + - rhel-8-x86_64 + s2i_base: ubi8/s2i-core + org: "rhel8" + prod: "rhel8" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + yum -y module enable nodejs:{{ spec.version }} && \ + post_install: >4- + (yum -y reinstall tzdata || yum -y update tzdata ) && \ + rhel9: + distros: + - rhel-9-x86_64 + s2i_base: ubi9/s2i-core + org: "rhel9" + prod: "rhel9" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + post_install: >4- + (yum -y reinstall tzdata || yum -y update tzdata ) && \ + rhel10: + distros: + - rhel-10-x86_64 + s2i_base: ubi10/s2i-core + org: "rhel10" + prod: "rhel10" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + c9s: + distros: + - centos-stream-9-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c9s:c9s + org: "sclorg" + prod: "c9s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + + c10s: + distros: + - centos-stream-10-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c10s:c10s + org: "sclorg" + prod: "c10s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + check_pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + + version: + "20": + version: "20" + prev_version: "18" + short: "20" + prev_short: "18" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + rhel_image_name: "rhel8/nodejs-{{ spec.short }}" + latest_fedora: "f38" + + "22": + version: "22" + prev_version: "20" + short: "22" + prev_short: "20" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f38" + + "24": + version: "24" + prev_version: "22" + short: "24" + prev_short: "22" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f40" + +matrix: + include: + - version: "20" + distros: + - rhel-8-x86_64 + - version: "22" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - centos-stream-9-x86_64 + - version: "24" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - centos-stream-9-x86_64 + - fedora-40-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 00000000..94309ec5 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,89 @@ +FROM {{ spec.s2i_base }}:latest + +# This image provides a Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION={{ spec.version }} \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.distroinfo.redhat_component %} \ + CNB_STACK_ID=com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }} \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0{% endif %} + +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.distroinfo.redhat_component %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }}"{% endif %} \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.distroinfo.redhat_component %} \ + com.redhat.component="{{ spec.distroinfo.redhat_component }}" \{% endif %} + name="{{ spec.distroinfo.img_name }}" \ + version="{% if spec.distroinfo.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.distroinfo.redhat_component %} \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="{% if spec.distroinfo.redhat_component %}s2i build {{ spec.distroinfo.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" + +{% if spec.distroinfo.environment_setup %} +RUN {{ spec.distroinfo.environment_setup }}{% endif %} + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.distroinfo.pkgs }}" && \ +{% if spec.distroinfo.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% else %} ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} + yum -y clean all --enablerepo='*'{% if spec.distroinfo.post_install %} + +RUN {{ spec.distroinfo.post_install }}{% endif %} + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/src/Dockerfile.fedora b/src/Dockerfile.fedora new file mode 100644 index 00000000..397ecbe8 --- /dev/null +++ b/src/Dockerfile.fedora @@ -0,0 +1,74 @@ +FROM {{ spec.s2i_base }}:{{ spec.latest_fedora | default("42") }} + +# This image provides a Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION={{ spec.version }} \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"\ + com.redhat.component="$NAME" \ + name="{{ spec.distroinfo.img_name }}" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME~" + +RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x /usr/libexec/s2i/init-wrapper + +# Copy extra files to the image, including help file. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file From 9120c0182e0b9a86b88ff98bf293401a60f5d0a5 Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Thu, 23 Apr 2026 16:40:40 +0200 Subject: [PATCH 2/9] Adjust specs/ manifest files --- manifest-minimal.yml | 62 ++++++++++++++++++++++++++++++ manifest.yml | 67 ++++++++++----------------------- specs/multispec.yml | 90 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 165 insertions(+), 54 deletions(-) create mode 100644 manifest-minimal.yml diff --git a/manifest-minimal.yml b/manifest-minimal.yml new file mode 100644 index 00000000..d4d53768 --- /dev/null +++ b/manifest-minimal.yml @@ -0,0 +1,62 @@ +# Manifest for image directories creation (minimal variants) +# every dest path will be prefixed by $DESTDIR/$version + +# Files containing distgen directives, which are used for each +# (distro, version) combination not excluded in multispec +DISTGEN_MULTI_RULES: + - src: src/Dockerfile.minimal + dest: Dockerfile.rhel8 + + - src: src/Dockerfile.minimal + dest: Dockerfile.rhel9 + + - src: src/Dockerfile.minimal + dest: Dockerfile.rhel10 + + - src: src/Dockerfile.minimal + dest: Dockerfile.c9s + + - src: src/Dockerfile.minimal + dest: Dockerfile.c10s + + - src: src/Dockerfile.minimal.fedora + dest: Dockerfile.fedora + +# Files to copy +COPY_RULES: + - src: src/s2i/bin/assemble + dest: s2i/bin/assemble + mode: "0755" + + - src: src/s2i/bin/run + dest: s2i/bin/run + mode: "0755" + + - src: src/s2i/bin/save-artifacts + dest: s2i/bin/save-artifacts + mode: "0755" + + - src: src/s2i/bin/usage + dest: s2i/bin/usage + mode: "0755" + + - src: src/s2i/bin/init-wrapper + dest: s2i/bin/init-wrapper + mode: "0755" + + - src: src/root/opt/app-root/etc/generate_container_user + dest: root/opt/app-root/etc/generate_container_user + + - src: src/root/opt/app-root/etc/npm_global_module_list + dest: root/opt/app-root/etc/npm_global_module_list + + - src: src/root/opt/app-root/etc/scl_enable + dest: root/opt/app-root/etc/scl_enable + +# Symbolic links +SYMLINK_RULES: + - src: ../test + dest: test + + - src: ../README.md + dest: README.md \ No newline at end of file diff --git a/manifest.yml b/manifest.yml index a411a86f..6b39da25 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,24 +1,6 @@ # Manifest for image directories creation # every dest path will be prefixed by $DESTDIR/$version -# Files containing distgen directives -DISTGEN_RULES: - - src: src/root/usr/share/container-scripts/nodejs/README.md - dest: root/usr/share/container-scripts/nodejs/README.md - - - src: src/root/usr/share/container-scripts/nodejs/common.sh - dest: root/usr/share/container-scripts/nodejs/common.sh - - - src: src/root/usr/bin/run-nodejs-slave - dest: root/usr/bin/run-nodejs-slave - mode: "0755" - - - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-recovery.conf.template - dest: root/usr/share/container-scripts/nodejs/openshift-custom-recovery.conf.template - - - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-postgresql-replication.conf.template - dest: root/usr/share/container-scripts/nodejs/openshift-custom-postgresql-replication.conf.template - # Files containing distgen directives, which are used for each # (distro, version) combination not excluded in multispec DISTGEN_MULTI_RULES: @@ -42,50 +24,39 @@ DISTGEN_MULTI_RULES: # Files to copy COPY_RULES: - - src: src/root/usr/libexec/fix-permissions - dest: root/usr/libexec/fix-permissions - mode: "0755" - - - src: src/root/usr/share/container-scripts/nodejs/openshift-custom-postgresql.conf.template - dest: root/usr/share/container-scripts/nodejs/openshift-custom-postgresql.conf.template - - - src: src/root/usr/bin/run-nodejs - dest: root/usr/bin/run-nodejs + - src: src/s2i/bin/assemble + dest: s2i/bin/assemble mode: "0755" - - src: src/root/usr/bin/run-nodejs-master - dest: root/usr/bin/run-nodejs-master + - src: src/s2i/bin/run + dest: s2i/bin/run mode: "0755" - - src: src/root/usr/bin/container-entrypoint - dest: root/usr/bin/container-entrypoint + - src: src/s2i/bin/save-artifacts + dest: s2i/bin/save-artifacts mode: "0755" - - src: src/root/usr/bin/usage - dest: root/usr/bin/usage + - src: src/s2i/bin/usage + dest: s2i/bin/usage mode: "0755" - - src: src/root/usr/libexec/check-container - dest: root/usr/libexec/check-container + - src: src/s2i/bin/init-wrapper + dest: s2i/bin/init-wrapper mode: "0755" - - src: src/root/usr/share/container-scripts/nodejs/start/set_passwords.sh - dest: root/usr/share/container-scripts/nodejs/start/set_passwords.sh + - src: src/root/opt/app-root/etc/generate_container_user + dest: root/opt/app-root/etc/generate_container_user - - src: src/s2i/bin/assemble - dest: s2i/bin/assemble - mode: "0755" + - src: src/root/opt/app-root/etc/npm_global_module_list + dest: root/opt/app-root/etc/npm_global_module_list - - src: src/s2i/bin/usage - dest: s2i/bin/usage - mode: "0755" + - src: src/root/opt/app-root/etc/scl_enable + dest: root/opt/app-root/etc/scl_enable # Symbolic links -# This section is the last one on purpose because the generator.py -# does not allow dead symlinks. SYMLINK_RULES: - - src: root/usr/share/container-scripts/nodejs/README.md - dest: README.md - - src: ../test dest: test + + - src: ../README.md + dest: README.md diff --git a/specs/multispec.yml b/specs/multispec.yml index 53056955..588541b4 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -2,6 +2,17 @@ version: 1 specs: distroinfo: + fedora42: + distros: + - fedora-42-x86_64 + s2i_base: quay.io/fedora/s2i-core + org: "fedora" + prod: "fedora" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + latest_fedora: "42" + fedora43: distros: - fedora-43-x86_64 @@ -11,6 +22,29 @@ specs: redhat_component: "nodejs-{{ spec.short }}-container" img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + latest_fedora: "43" + + fedora44: + distros: + - fedora-44-x86_64 + s2i_base: quay.io/fedora/s2i-core + org: "fedora" + prod: "fedora" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + latest_fedora: "44" + + fedora45: + distros: + - fedora-45-x86_64 + s2i_base: quay.io/fedora/s2i-core + org: "fedora" + prod: "fedora" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + latest_fedora: "45" rhel8: distros: @@ -73,12 +107,10 @@ specs: version: "20": version: "20" - prev_version: "18" short: "20" - prev_short: "18" common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" rhel_image_name: "rhel8/nodejs-{{ spec.short }}" - latest_fedora: "f38" + latest_fedora: "f45" "22": version: "22" @@ -88,7 +120,7 @@ specs: common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" - latest_fedora: "f38" + latest_fedora: "f45" "24": version: "24" @@ -98,21 +130,67 @@ specs: common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" - latest_fedora: "f40" + latest_fedora: "f45" + + "20-minimal": + version: "20" + short: "20-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + rhel_image_name: "rhel8/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "22-minimal": + version: "22" + prev_version: "20" + short: "22-minimal" + prev_short: "20-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "24-minimal": + version: "24" + prev_version: "22" + short: "24-minimal" + prev_short: "22-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" matrix: include: - version: "20" distros: - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-42-x86_64 + - fedora-43-x86_64 + - fedora-44-x86_64 + - fedora-45-x86_64 - version: "22" distros: - rhel-8-x86_64 - rhel-9-x86_64 + - rhel-10-x86_64 - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-42-x86_64 + - fedora-43-x86_64 + - fedora-44-x86_64 + - fedora-45-x86_64 - version: "24" distros: - rhel-8-x86_64 - rhel-9-x86_64 + - rhel-10-x86_64 - centos-stream-9-x86_64 - - fedora-40-x86_64 + - centos-stream-10-x86_64 + - fedora-42-x86_64 + - fedora-43-x86_64 + - fedora-44-x86_64 + - fedora-45-x86_64 From a041e0fa25e00b299d45cd4d9527190212088859 Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Thu, 23 Apr 2026 16:45:31 +0200 Subject: [PATCH 3/9] Add generation makefile --- 18-minimal/.exclude-c8s | 0 18-minimal/.exclude-c9s | 0 18-minimal/Dockerfile.c8s | 70 ---- 18-minimal/Dockerfile.c9s | 69 ---- 18-minimal/Dockerfile.fedora | 67 ---- 18-minimal/Dockerfile.rhel8 | 71 ---- 18-minimal/Dockerfile.rhel9 | 71 ---- 18-minimal/README.md | 4 - 18-minimal/root/usr/bin/fix-permissions | 27 -- 18-minimal/s2i/bin/assemble | 117 ------ 18-minimal/s2i/bin/init-wrapper | 18 - 18-minimal/s2i/bin/run | 79 ---- 18-minimal/s2i/bin/save-artifacts | 5 - 18-minimal/s2i/bin/usage | 15 - 18-minimal/test/check_imagestreams.py | 1 - 18-minimal/test/examples | 1 - 18-minimal/test/imagestreams | 1 - 18-minimal/test/run | 1 - 18-minimal/test/run-openshift-remote-cluster | 1 - 18-minimal/test/test-app | 1 - 18-minimal/test/test-binary | 1 - 18-minimal/test/test-express-webapp | 1 - 18-minimal/test/test-hw | 1 - 18-minimal/test/test-incremental | 1 - 18-minimal/test/test-lib-nodejs.sh | 1 - 18-minimal/test/test-lib-openshift.sh | 1 - 18-minimal/test/test-lib-remote-openshift.sh | 1 - 18-minimal/test/test-lib.sh | 1 - 18-minimal/test/test-openshift.yaml | 1 - 18/.exclude-c8s | 0 18/.exclude-c9s | 0 18/Dockerfile.c8s | 80 ---- 18/Dockerfile.c9s | 80 ---- 18/Dockerfile.fedora | 72 ---- 18/Dockerfile.rhel8 | 80 ---- 18/Dockerfile.rhel9 | 79 ---- 18/README.md | 4 - .../opt/app-root/etc/generate_container_user | 17 - .../opt/app-root/etc/npm_global_module_list | 5 - 18/root/opt/app-root/etc/scl_enable | 3 - 18/s2i/bin/assemble | 116 ------ 18/s2i/bin/init-wrapper | 18 - 18/s2i/bin/run | 83 ---- 18/s2i/bin/save-artifacts | 5 - 18/s2i/bin/usage | 15 - 18/test | 1 - 20-minimal/.exclude-c8s | 0 20-minimal/.exclude-fedora | 0 20-minimal/Dockerfile.c8s | 69 ---- 20-minimal/Dockerfile.c9s | 69 ---- 20-minimal/Dockerfile.fedora | 72 ---- 20-minimal/Dockerfile.rhel8 | 70 ---- 20-minimal/Dockerfile.rhel9 | 70 ---- 20-minimal/README.md | 375 ----------------- 20-minimal/root/usr/bin/fix-permissions | 27 -- 20-minimal/s2i/bin/assemble | 123 ------ 20-minimal/s2i/bin/init-wrapper | 18 - 20-minimal/s2i/bin/run | 79 ---- 20-minimal/s2i/bin/save-artifacts | 5 - 20-minimal/s2i/bin/usage | 15 - 20-minimal/test/__init__.py | 1 - 20-minimal/test/check_imagestreams.py | 1 - 20-minimal/test/conftest.py | 1 - 20-minimal/test/examples | 1 - 20-minimal/test/imagestreams | 1 - 20-minimal/test/run | 1 - 20-minimal/test/run-openshift-remote-cluster | 1 - 20-minimal/test/run-pytest | 1 - 20-minimal/test/test-app | 1 - 20-minimal/test/test-binary | 1 - 20-minimal/test/test-express-webapp | 1 - 20-minimal/test/test-fips | 1 - 20-minimal/test/test-hw | 1 - 20-minimal/test/test-incremental | 1 - 20-minimal/test/test-lib-nodejs.sh | 1 - 20-minimal/test/test-lib-openshift.sh | 1 - 20-minimal/test/test-lib-remote-openshift.sh | 1 - 20-minimal/test/test-lib.sh | 1 - 20-minimal/test/test-openshift.yaml | 1 - 20-minimal/test/test_container_apps.py | 1 - 20-minimal/test/test_container_basics.py | 1 - 20/.exclude-c8s | 0 20/.exclude-fedora | 0 20/Dockerfile.c8s | 80 ---- 20/Dockerfile.c9s | 80 ---- 20/Dockerfile.fedora | 76 ---- 20/Dockerfile.rhel8 | 80 ---- 20/Dockerfile.rhel9 | 79 ---- 20/README.md | 303 -------------- .../opt/app-root/etc/generate_container_user | 17 - .../opt/app-root/etc/npm_global_module_list | 5 - 20/root/opt/app-root/etc/scl_enable | 3 - 20/s2i/bin/assemble | 123 ------ 20/s2i/bin/init-wrapper | 18 - 20/s2i/bin/run | 83 ---- 20/s2i/bin/save-artifacts | 5 - 20/s2i/bin/usage | 15 - 20/test | 1 - 22-minimal/.exclude-c8s | 0 22-minimal/.exclude-c9s | 0 22-minimal/.exclude-fedora | 0 22-minimal/Dockerfile.c10s | 67 ---- 22-minimal/Dockerfile.c8s | 69 ---- 22-minimal/Dockerfile.c9s | 69 ---- 22-minimal/Dockerfile.fedora | 71 ---- 22-minimal/Dockerfile.rhel10 | 67 ---- 22-minimal/Dockerfile.rhel8 | 70 ---- 22-minimal/Dockerfile.rhel9 | 70 ---- 22-minimal/README.md | 376 ------------------ 22-minimal/root/usr/bin/fix-permissions | 27 -- 22-minimal/s2i/bin/assemble | 123 ------ 22-minimal/s2i/bin/init-wrapper | 18 - 22-minimal/s2i/bin/run | 79 ---- 22-minimal/s2i/bin/save-artifacts | 5 - 22-minimal/s2i/bin/usage | 15 - 22-minimal/test/__init__.py | 1 - 22-minimal/test/check_imagestreams.py | 1 - 22-minimal/test/conftest.py | 1 - 22-minimal/test/examples | 1 - 22-minimal/test/imagestreams | 1 - 22-minimal/test/run | 1 - 22-minimal/test/run-openshift-remote-cluster | 1 - 22-minimal/test/run-pytest | 1 - 22-minimal/test/test-app | 1 - 22-minimal/test/test-binary | 1 - 22-minimal/test/test-express-webapp | 1 - 22-minimal/test/test-fips | 1 - 22-minimal/test/test-hw | 1 - 22-minimal/test/test-incremental | 1 - 22-minimal/test/test-lib-nodejs.sh | 1 - 22-minimal/test/test-lib-openshift.sh | 1 - 22-minimal/test/test-lib-remote-openshift.sh | 1 - 22-minimal/test/test-lib.sh | 1 - 22-minimal/test/test-openshift.yaml | 1 - 22-minimal/test/test_container_apps.py | 1 - 22-minimal/test/test_container_basics.py | 1 - 22/.exclude-c8s | 0 22/.exclude-c9s | 0 22/.exclude-fedora | 0 22/Dockerfile.c10s | 80 ---- 22/Dockerfile.c8s | 80 ---- 22/Dockerfile.c9s | 80 ---- 22/Dockerfile.fedora | 74 ---- 22/Dockerfile.rhel10 | 79 ---- 22/Dockerfile.rhel8 | 85 ---- 22/Dockerfile.rhel9 | 79 ---- 22/README.md | 305 -------------- .../opt/app-root/etc/generate_container_user | 17 - .../opt/app-root/etc/npm_global_module_list | 5 - 22/root/opt/app-root/etc/scl_enable | 3 - 22/s2i/bin/assemble | 123 ------ 22/s2i/bin/init-wrapper | 18 - 22/s2i/bin/run | 83 ---- 22/s2i/bin/save-artifacts | 5 - 22/s2i/bin/usage | 15 - 22/test | 1 - 24-minimal/.exclude-c8s | 0 24-minimal/.exclude-rhel8 | 0 24-minimal/Dockerfile.c10s | 70 ---- 24-minimal/Dockerfile.c8s | 69 ---- 24-minimal/Dockerfile.c9s | 69 ---- 24-minimal/Dockerfile.fedora | 71 ---- 24-minimal/Dockerfile.rhel10 | 70 ---- 24-minimal/Dockerfile.rhel8 | 70 ---- 24-minimal/Dockerfile.rhel9 | 70 ---- 24-minimal/README.md | 376 ------------------ 24-minimal/root/usr/bin/fix-permissions | 27 -- 24-minimal/s2i/bin/assemble | 123 ------ 24-minimal/s2i/bin/init-wrapper | 18 - 24-minimal/s2i/bin/run | 79 ---- 24-minimal/s2i/bin/save-artifacts | 5 - 24-minimal/s2i/bin/usage | 15 - 24-minimal/test/__init__.py | 1 - 24-minimal/test/check_imagestreams.py | 1 - 24-minimal/test/conftest.py | 1 - 24-minimal/test/examples | 1 - 24-minimal/test/imagestreams | 1 - 24-minimal/test/run | 1 - 24-minimal/test/run-openshift-remote-cluster | 1 - 24-minimal/test/run-pytest | 1 - 24-minimal/test/test-app | 1 - 24-minimal/test/test-binary | 1 - 24-minimal/test/test-express-webapp | 1 - 24-minimal/test/test-fips | 1 - 24-minimal/test/test-hw | 1 - 24-minimal/test/test-incremental | 1 - 24-minimal/test/test-lib-nodejs.sh | 1 - 24-minimal/test/test-lib-openshift.sh | 1 - 24-minimal/test/test-lib-remote-openshift.sh | 1 - 24-minimal/test/test-lib.sh | 1 - 24-minimal/test/test-openshift.yaml | 1 - 24-minimal/test/test_container_apps.py | 1 - 24-minimal/test/test_container_basics.py | 1 - 24/.exclude-c8s | 0 24/.exclude-rhel8 | 0 24/Dockerfile.c10s | 80 ---- 24/Dockerfile.c8s | 80 ---- 24/Dockerfile.c9s | 80 ---- 24/Dockerfile.fedora | 74 ---- 24/Dockerfile.rhel10 | 79 ---- 24/Dockerfile.rhel8 | 85 ---- 24/Dockerfile.rhel9 | 79 ---- 24/README.md | 305 -------------- .../opt/app-root/etc/generate_container_user | 17 - .../opt/app-root/etc/npm_global_module_list | 5 - 24/root/opt/app-root/etc/scl_enable | 3 - 24/s2i/bin/assemble | 123 ------ 24/s2i/bin/init-wrapper | 18 - 24/s2i/bin/run | 83 ---- 24/s2i/bin/save-artifacts | 5 - 24/s2i/bin/usage | 15 - 24/test | 1 - 212 files changed, 7831 deletions(-) delete mode 100644 18-minimal/.exclude-c8s delete mode 100644 18-minimal/.exclude-c9s delete mode 100644 18-minimal/Dockerfile.c8s delete mode 100644 18-minimal/Dockerfile.c9s delete mode 100644 18-minimal/Dockerfile.fedora delete mode 100644 18-minimal/Dockerfile.rhel8 delete mode 100644 18-minimal/Dockerfile.rhel9 delete mode 100644 18-minimal/README.md delete mode 100755 18-minimal/root/usr/bin/fix-permissions delete mode 100755 18-minimal/s2i/bin/assemble delete mode 100644 18-minimal/s2i/bin/init-wrapper delete mode 100755 18-minimal/s2i/bin/run delete mode 100755 18-minimal/s2i/bin/save-artifacts delete mode 100755 18-minimal/s2i/bin/usage delete mode 120000 18-minimal/test/check_imagestreams.py delete mode 120000 18-minimal/test/examples delete mode 120000 18-minimal/test/imagestreams delete mode 120000 18-minimal/test/run delete mode 120000 18-minimal/test/run-openshift-remote-cluster delete mode 120000 18-minimal/test/test-app delete mode 120000 18-minimal/test/test-binary delete mode 120000 18-minimal/test/test-express-webapp delete mode 120000 18-minimal/test/test-hw delete mode 120000 18-minimal/test/test-incremental delete mode 120000 18-minimal/test/test-lib-nodejs.sh delete mode 120000 18-minimal/test/test-lib-openshift.sh delete mode 120000 18-minimal/test/test-lib-remote-openshift.sh delete mode 120000 18-minimal/test/test-lib.sh delete mode 120000 18-minimal/test/test-openshift.yaml delete mode 100644 18/.exclude-c8s delete mode 100644 18/.exclude-c9s delete mode 100644 18/Dockerfile.c8s delete mode 100644 18/Dockerfile.c9s delete mode 100644 18/Dockerfile.fedora delete mode 100644 18/Dockerfile.rhel8 delete mode 100644 18/Dockerfile.rhel9 delete mode 100644 18/README.md delete mode 100644 18/root/opt/app-root/etc/generate_container_user delete mode 100644 18/root/opt/app-root/etc/npm_global_module_list delete mode 100644 18/root/opt/app-root/etc/scl_enable delete mode 100755 18/s2i/bin/assemble delete mode 100644 18/s2i/bin/init-wrapper delete mode 100755 18/s2i/bin/run delete mode 100755 18/s2i/bin/save-artifacts delete mode 100755 18/s2i/bin/usage delete mode 120000 18/test delete mode 100644 20-minimal/.exclude-c8s delete mode 100644 20-minimal/.exclude-fedora delete mode 100644 20-minimal/Dockerfile.c8s delete mode 100644 20-minimal/Dockerfile.c9s delete mode 100644 20-minimal/Dockerfile.fedora delete mode 100644 20-minimal/Dockerfile.rhel8 delete mode 100644 20-minimal/Dockerfile.rhel9 delete mode 100644 20-minimal/README.md delete mode 100755 20-minimal/root/usr/bin/fix-permissions delete mode 100755 20-minimal/s2i/bin/assemble delete mode 100644 20-minimal/s2i/bin/init-wrapper delete mode 100755 20-minimal/s2i/bin/run delete mode 100755 20-minimal/s2i/bin/save-artifacts delete mode 100755 20-minimal/s2i/bin/usage delete mode 120000 20-minimal/test/__init__.py delete mode 120000 20-minimal/test/check_imagestreams.py delete mode 120000 20-minimal/test/conftest.py delete mode 120000 20-minimal/test/examples delete mode 120000 20-minimal/test/imagestreams delete mode 120000 20-minimal/test/run delete mode 120000 20-minimal/test/run-openshift-remote-cluster delete mode 120000 20-minimal/test/run-pytest delete mode 120000 20-minimal/test/test-app delete mode 120000 20-minimal/test/test-binary delete mode 120000 20-minimal/test/test-express-webapp delete mode 120000 20-minimal/test/test-fips delete mode 120000 20-minimal/test/test-hw delete mode 120000 20-minimal/test/test-incremental delete mode 120000 20-minimal/test/test-lib-nodejs.sh delete mode 120000 20-minimal/test/test-lib-openshift.sh delete mode 120000 20-minimal/test/test-lib-remote-openshift.sh delete mode 120000 20-minimal/test/test-lib.sh delete mode 120000 20-minimal/test/test-openshift.yaml delete mode 120000 20-minimal/test/test_container_apps.py delete mode 120000 20-minimal/test/test_container_basics.py delete mode 100644 20/.exclude-c8s delete mode 100644 20/.exclude-fedora delete mode 100644 20/Dockerfile.c8s delete mode 100644 20/Dockerfile.c9s delete mode 100644 20/Dockerfile.fedora delete mode 100644 20/Dockerfile.rhel8 delete mode 100644 20/Dockerfile.rhel9 delete mode 100644 20/README.md delete mode 100644 20/root/opt/app-root/etc/generate_container_user delete mode 100644 20/root/opt/app-root/etc/npm_global_module_list delete mode 100644 20/root/opt/app-root/etc/scl_enable delete mode 100755 20/s2i/bin/assemble delete mode 100644 20/s2i/bin/init-wrapper delete mode 100755 20/s2i/bin/run delete mode 100755 20/s2i/bin/save-artifacts delete mode 100755 20/s2i/bin/usage delete mode 120000 20/test delete mode 100644 22-minimal/.exclude-c8s delete mode 100644 22-minimal/.exclude-c9s delete mode 100644 22-minimal/.exclude-fedora delete mode 100644 22-minimal/Dockerfile.c10s delete mode 100644 22-minimal/Dockerfile.c8s delete mode 100644 22-minimal/Dockerfile.c9s delete mode 100644 22-minimal/Dockerfile.fedora delete mode 100644 22-minimal/Dockerfile.rhel10 delete mode 100644 22-minimal/Dockerfile.rhel8 delete mode 100644 22-minimal/Dockerfile.rhel9 delete mode 100644 22-minimal/README.md delete mode 100755 22-minimal/root/usr/bin/fix-permissions delete mode 100755 22-minimal/s2i/bin/assemble delete mode 100644 22-minimal/s2i/bin/init-wrapper delete mode 100755 22-minimal/s2i/bin/run delete mode 100755 22-minimal/s2i/bin/save-artifacts delete mode 100755 22-minimal/s2i/bin/usage delete mode 120000 22-minimal/test/__init__.py delete mode 120000 22-minimal/test/check_imagestreams.py delete mode 120000 22-minimal/test/conftest.py delete mode 120000 22-minimal/test/examples delete mode 120000 22-minimal/test/imagestreams delete mode 120000 22-minimal/test/run delete mode 120000 22-minimal/test/run-openshift-remote-cluster delete mode 120000 22-minimal/test/run-pytest delete mode 120000 22-minimal/test/test-app delete mode 120000 22-minimal/test/test-binary delete mode 120000 22-minimal/test/test-express-webapp delete mode 120000 22-minimal/test/test-fips delete mode 120000 22-minimal/test/test-hw delete mode 120000 22-minimal/test/test-incremental delete mode 120000 22-minimal/test/test-lib-nodejs.sh delete mode 120000 22-minimal/test/test-lib-openshift.sh delete mode 120000 22-minimal/test/test-lib-remote-openshift.sh delete mode 120000 22-minimal/test/test-lib.sh delete mode 120000 22-minimal/test/test-openshift.yaml delete mode 120000 22-minimal/test/test_container_apps.py delete mode 120000 22-minimal/test/test_container_basics.py delete mode 100644 22/.exclude-c8s delete mode 100644 22/.exclude-c9s delete mode 100644 22/.exclude-fedora delete mode 100644 22/Dockerfile.c10s delete mode 100644 22/Dockerfile.c8s delete mode 100644 22/Dockerfile.c9s delete mode 100644 22/Dockerfile.fedora delete mode 100644 22/Dockerfile.rhel10 delete mode 100644 22/Dockerfile.rhel8 delete mode 100644 22/Dockerfile.rhel9 delete mode 100644 22/README.md delete mode 100644 22/root/opt/app-root/etc/generate_container_user delete mode 100644 22/root/opt/app-root/etc/npm_global_module_list delete mode 100644 22/root/opt/app-root/etc/scl_enable delete mode 100755 22/s2i/bin/assemble delete mode 100644 22/s2i/bin/init-wrapper delete mode 100755 22/s2i/bin/run delete mode 100755 22/s2i/bin/save-artifacts delete mode 100755 22/s2i/bin/usage delete mode 120000 22/test delete mode 100644 24-minimal/.exclude-c8s delete mode 100644 24-minimal/.exclude-rhel8 delete mode 100644 24-minimal/Dockerfile.c10s delete mode 100644 24-minimal/Dockerfile.c8s delete mode 100644 24-minimal/Dockerfile.c9s delete mode 100644 24-minimal/Dockerfile.fedora delete mode 100644 24-minimal/Dockerfile.rhel10 delete mode 100644 24-minimal/Dockerfile.rhel8 delete mode 100644 24-minimal/Dockerfile.rhel9 delete mode 100644 24-minimal/README.md delete mode 100755 24-minimal/root/usr/bin/fix-permissions delete mode 100755 24-minimal/s2i/bin/assemble delete mode 100644 24-minimal/s2i/bin/init-wrapper delete mode 100755 24-minimal/s2i/bin/run delete mode 100755 24-minimal/s2i/bin/save-artifacts delete mode 100755 24-minimal/s2i/bin/usage delete mode 120000 24-minimal/test/__init__.py delete mode 120000 24-minimal/test/check_imagestreams.py delete mode 120000 24-minimal/test/conftest.py delete mode 120000 24-minimal/test/examples delete mode 120000 24-minimal/test/imagestreams delete mode 120000 24-minimal/test/run delete mode 120000 24-minimal/test/run-openshift-remote-cluster delete mode 120000 24-minimal/test/run-pytest delete mode 120000 24-minimal/test/test-app delete mode 120000 24-minimal/test/test-binary delete mode 120000 24-minimal/test/test-express-webapp delete mode 120000 24-minimal/test/test-fips delete mode 120000 24-minimal/test/test-hw delete mode 120000 24-minimal/test/test-incremental delete mode 120000 24-minimal/test/test-lib-nodejs.sh delete mode 120000 24-minimal/test/test-lib-openshift.sh delete mode 120000 24-minimal/test/test-lib-remote-openshift.sh delete mode 120000 24-minimal/test/test-lib.sh delete mode 120000 24-minimal/test/test-openshift.yaml delete mode 120000 24-minimal/test/test_container_apps.py delete mode 120000 24-minimal/test/test_container_basics.py delete mode 100644 24/.exclude-c8s delete mode 100644 24/.exclude-rhel8 delete mode 100644 24/Dockerfile.c10s delete mode 100644 24/Dockerfile.c8s delete mode 100644 24/Dockerfile.c9s delete mode 100644 24/Dockerfile.fedora delete mode 100644 24/Dockerfile.rhel10 delete mode 100644 24/Dockerfile.rhel8 delete mode 100644 24/Dockerfile.rhel9 delete mode 100644 24/README.md delete mode 100644 24/root/opt/app-root/etc/generate_container_user delete mode 100644 24/root/opt/app-root/etc/npm_global_module_list delete mode 100644 24/root/opt/app-root/etc/scl_enable delete mode 100755 24/s2i/bin/assemble delete mode 100644 24/s2i/bin/init-wrapper delete mode 100755 24/s2i/bin/run delete mode 100755 24/s2i/bin/save-artifacts delete mode 100755 24/s2i/bin/usage delete mode 120000 24/test diff --git a/18-minimal/.exclude-c8s b/18-minimal/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/18-minimal/.exclude-c9s b/18-minimal/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/18-minimal/Dockerfile.c8s b/18-minimal/Dockerfile.c8s deleted file mode 100644 index 07b65fb4..00000000 --- a/18-minimal/Dockerfile.c8s +++ /dev/null @@ -1,70 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=18 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i - -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/18-minimal/Dockerfile.c9s b/18-minimal/Dockerfile.c9s deleted file mode 100644 index ecba5276..00000000 --- a/18-minimal/Dockerfile.c9s +++ /dev/null @@ -1,69 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c9s - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=18 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/18-minimal/Dockerfile.fedora b/18-minimal/Dockerfile.fedora deleted file mode 100644 index 18ec1c36..00000000 --- a/18-minimal/Dockerfile.fedora +++ /dev/null @@ -1,67 +0,0 @@ -FROM quay.io/fedora/fedora-minimal:38 - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="fedora" \ - NODEJS_VERSION=18 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="fedora/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n nodejs-npm findutils tar which nss_wrapper-libs" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - microdnf clean all && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/18-minimal/Dockerfile.rhel8 b/18-minimal/Dockerfile.rhel8 deleted file mode 100644 index 61327509..00000000 --- a/18-minimal/Dockerfile.rhel8 +++ /dev/null @@ -1,71 +0,0 @@ -FROM ubi8/ubi-minimal:latest - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=18 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i - -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/18-minimal/Dockerfile.rhel9 b/18-minimal/Dockerfile.rhel9 deleted file mode 100644 index cdff8219..00000000 --- a/18-minimal/Dockerfile.rhel9 +++ /dev/null @@ -1,71 +0,0 @@ -FROM ubi9/ubi-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=18 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i - -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/18-minimal/README.md b/18-minimal/README.md deleted file mode 100644 index 28f2ac21..00000000 --- a/18-minimal/README.md +++ /dev/null @@ -1,4 +0,0 @@ -NodeJS 18 minimal container image -========================= - -**The NodeJS 18 minimal image is deprecated.** \ No newline at end of file diff --git a/18-minimal/root/usr/bin/fix-permissions b/18-minimal/root/usr/bin/fix-permissions deleted file mode 100755 index ddd33ace..00000000 --- a/18-minimal/root/usr/bin/fix-permissions +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Allow this script to fail without failing a build -set +e - -SYMLINK_OPT=${2:--L} - -# Fix permissions on the given directory or file to allow group read/write of -# regular files and execute of directories. - -[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)" - -# If argument does not exist, script will still exit with 0, -# but at least we'll see something went wrong in the log -if ! [ -e "$1" ] ; then - echo "ERROR: File or directory $1 does not exist." >&2 - # We still want to end successfully - exit 0 -fi - -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} + - -# Always end successfully -exit 0 diff --git a/18-minimal/s2i/bin/assemble b/18-minimal/s2i/bin/assemble deleted file mode 100755 index a5767210..00000000 --- a/18-minimal/s2i/bin/assemble +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi - -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/18-minimal/s2i/bin/init-wrapper b/18-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/18-minimal/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/18-minimal/s2i/bin/run b/18-minimal/s2i/bin/run deleted file mode 100755 index 45d23d69..00000000 --- a/18-minimal/s2i/bin/run +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/18-minimal/s2i/bin/save-artifacts b/18-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/18-minimal/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/18-minimal/s2i/bin/usage b/18-minimal/s2i/bin/usage deleted file mode 100755 index e2d9e3be..00000000 --- a/18-minimal/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < $NSS_WRAPPER_PASSWD - - echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD - - export NSS_WRAPPER_PASSWD - export NSS_WRAPPER_GROUP - export LD_PRELOAD=libnss_wrapper.so -fi diff --git a/18/root/opt/app-root/etc/npm_global_module_list b/18/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/18/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/18/root/opt/app-root/etc/scl_enable b/18/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/18/root/opt/app-root/etc/scl_enable +++ /dev/null @@ -1,3 +0,0 @@ -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/18/s2i/bin/assemble b/18/s2i/bin/assemble deleted file mode 100755 index f644a811..00000000 --- a/18/s2i/bin/assemble +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/18/s2i/bin/init-wrapper b/18/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/18/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/18/s2i/bin/run b/18/s2i/bin/run deleted file mode 100755 index 9fc5cf90..00000000 --- a/18/s2i/bin/run +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -if [ -e "/opt/app-root/etc/generate_container_user" ]; then - source /opt/app-root/etc/generate_container_user -fi - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/18/s2i/bin/save-artifacts b/18/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/18/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/18/s2i/bin/usage b/18/s2i/bin/usage deleted file mode 100755 index d77326cf..00000000 --- a/18/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -for RHEL8 it's `Dockerfile.rhel8` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/20-minimal/root/usr/bin/fix-permissions b/20-minimal/root/usr/bin/fix-permissions deleted file mode 100755 index ddd33ace..00000000 --- a/20-minimal/root/usr/bin/fix-permissions +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Allow this script to fail without failing a build -set +e - -SYMLINK_OPT=${2:--L} - -# Fix permissions on the given directory or file to allow group read/write of -# regular files and execute of directories. - -[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)" - -# If argument does not exist, script will still exit with 0, -# but at least we'll see something went wrong in the log -if ! [ -e "$1" ] ; then - echo "ERROR: File or directory $1 does not exist." >&2 - # We still want to end successfully - exit 0 -fi - -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} + - -# Always end successfully -exit 0 diff --git a/20-minimal/s2i/bin/assemble b/20-minimal/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/20-minimal/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/20-minimal/s2i/bin/init-wrapper b/20-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/20-minimal/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/20-minimal/s2i/bin/run b/20-minimal/s2i/bin/run deleted file mode 100755 index 10150f34..00000000 --- a/20-minimal/s2i/bin/run +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/20-minimal/s2i/bin/save-artifacts b/20-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/20-minimal/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/20-minimal/s2i/bin/usage b/20-minimal/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/20-minimal/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/20-minimal/test/__init__.py b/20-minimal/test/__init__.py deleted file mode 120000 index d0f4746a..00000000 --- a/20-minimal/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -../../test/__init__.py \ No newline at end of file diff --git a/20-minimal/test/check_imagestreams.py b/20-minimal/test/check_imagestreams.py deleted file mode 120000 index 56bb2be7..00000000 --- a/20-minimal/test/check_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../common/check_imagestreams.py \ No newline at end of file diff --git a/20-minimal/test/conftest.py b/20-minimal/test/conftest.py deleted file mode 120000 index 3f2d7840..00000000 --- a/20-minimal/test/conftest.py +++ /dev/null @@ -1 +0,0 @@ -../../test/conftest.py \ No newline at end of file diff --git a/20-minimal/test/examples b/20-minimal/test/examples deleted file mode 120000 index d15735c1..00000000 --- a/20-minimal/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples \ No newline at end of file diff --git a/20-minimal/test/imagestreams b/20-minimal/test/imagestreams deleted file mode 120000 index 7a0aee9c..00000000 --- a/20-minimal/test/imagestreams +++ /dev/null @@ -1 +0,0 @@ -../../imagestreams \ No newline at end of file diff --git a/20-minimal/test/run b/20-minimal/test/run deleted file mode 120000 index f446a740..00000000 --- a/20-minimal/test/run +++ /dev/null @@ -1 +0,0 @@ -../../test/run-minimal \ No newline at end of file diff --git a/20-minimal/test/run-openshift-remote-cluster b/20-minimal/test/run-openshift-remote-cluster deleted file mode 120000 index 1bffcba8..00000000 --- a/20-minimal/test/run-openshift-remote-cluster +++ /dev/null @@ -1 +0,0 @@ -../../test/run-openshift-remote-cluster \ No newline at end of file diff --git a/20-minimal/test/run-pytest b/20-minimal/test/run-pytest deleted file mode 120000 index efe32b48..00000000 --- a/20-minimal/test/run-pytest +++ /dev/null @@ -1 +0,0 @@ -../../test/run-pytest \ No newline at end of file diff --git a/20-minimal/test/test-app b/20-minimal/test/test-app deleted file mode 120000 index 6ba4f290..00000000 --- a/20-minimal/test/test-app +++ /dev/null @@ -1 +0,0 @@ -../../test/test-app \ No newline at end of file diff --git a/20-minimal/test/test-binary b/20-minimal/test/test-binary deleted file mode 120000 index cd7b631f..00000000 --- a/20-minimal/test/test-binary +++ /dev/null @@ -1 +0,0 @@ -../../test/test-binary \ No newline at end of file diff --git a/20-minimal/test/test-express-webapp b/20-minimal/test/test-express-webapp deleted file mode 120000 index 6a5bbd41..00000000 --- a/20-minimal/test/test-express-webapp +++ /dev/null @@ -1 +0,0 @@ -../../test/test-express-webapp \ No newline at end of file diff --git a/20-minimal/test/test-fips b/20-minimal/test/test-fips deleted file mode 120000 index fbe9489f..00000000 --- a/20-minimal/test/test-fips +++ /dev/null @@ -1 +0,0 @@ -../../test/test-fips \ No newline at end of file diff --git a/20-minimal/test/test-hw b/20-minimal/test/test-hw deleted file mode 120000 index ad784558..00000000 --- a/20-minimal/test/test-hw +++ /dev/null @@ -1 +0,0 @@ -../../test/test-hw \ No newline at end of file diff --git a/20-minimal/test/test-incremental b/20-minimal/test/test-incremental deleted file mode 120000 index 0a357b1f..00000000 --- a/20-minimal/test/test-incremental +++ /dev/null @@ -1 +0,0 @@ -../../test/test-incremental \ No newline at end of file diff --git a/20-minimal/test/test-lib-nodejs.sh b/20-minimal/test/test-lib-nodejs.sh deleted file mode 120000 index 8915d844..00000000 --- a/20-minimal/test/test-lib-nodejs.sh +++ /dev/null @@ -1 +0,0 @@ -../../test/test-lib-nodejs.sh \ No newline at end of file diff --git a/20-minimal/test/test-lib-openshift.sh b/20-minimal/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/20-minimal/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/20-minimal/test/test-lib-remote-openshift.sh b/20-minimal/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/20-minimal/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/20-minimal/test/test-lib.sh b/20-minimal/test/test-lib.sh deleted file mode 120000 index 1ac99b93..00000000 --- a/20-minimal/test/test-lib.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib.sh \ No newline at end of file diff --git a/20-minimal/test/test-openshift.yaml b/20-minimal/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/20-minimal/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/20-minimal/test/test_container_apps.py b/20-minimal/test/test_container_apps.py deleted file mode 120000 index 9870de8e..00000000 --- a/20-minimal/test/test_container_apps.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_apps.py \ No newline at end of file diff --git a/20-minimal/test/test_container_basics.py b/20-minimal/test/test_container_basics.py deleted file mode 120000 index b85dc139..00000000 --- a/20-minimal/test/test_container_basics.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_basics.py \ No newline at end of file diff --git a/20/.exclude-c8s b/20/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/20/.exclude-fedora b/20/.exclude-fedora deleted file mode 100644 index e69de29b..00000000 diff --git a/20/Dockerfile.c8s b/20/Dockerfile.c8s deleted file mode 100644 index abc9d7b9..00000000 --- a/20/Dockerfile.c8s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.c9s b/20/Dockerfile.c9s deleted file mode 100644 index d0cba57a..00000000 --- a/20/Dockerfile.c9s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " - -# Package libatomic_ops was removed -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.fedora b/20/Dockerfile.fedora deleted file mode 100644 index 63c07378..00000000 --- a/20/Dockerfile.fedora +++ /dev/null @@ -1,76 +0,0 @@ -FROM quay.io/fedora/s2i-core:38 - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="fedora/$NAME-$NODEJS_VERSION" \ - version="$NODEJS_VERSION" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" - -RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper - -# Copy extra files to the image, including help file. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.rhel8 b/20/Dockerfile.rhel8 deleted file mode 100644 index 6f620c76..00000000 --- a/20/Dockerfile.rhel8 +++ /dev/null @@ -1,80 +0,0 @@ -FROM ubi8/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi8/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " - -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.rhel9 b/20/Dockerfile.rhel9 deleted file mode 100644 index 74a5f7ee..00000000 --- a/20/Dockerfile.rhel9 +++ /dev/null @@ -1,79 +0,0 @@ -FROM ubi9/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi9/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " - -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/20/README.md b/20/README.md deleted file mode 100644 index 3cebc465..00000000 --- a/20/README.md +++ /dev/null @@ -1,303 +0,0 @@ -NodeJS 20 container image -========================= - -This container image includes Node.JS 20 as a [S2I](https://github.com/openshift/source-to-image) base image for your Node.JS 20 applications. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 20 available as container is a base platform for -building and running various Node.js 20 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-20` image, available via `nodejs:20` imagestream tag in Openshift. - -To build a simple [nodejs-sample-app](https://github.com/sclorg/nodejs-ex.git) application in Openshift: - -``` -oc new-app nodejs:20~https://github.com/sclorg/nodejs-ex.git -``` - -To access the application: -``` -$ oc get pods -$ oc exec -- curl 127.0.0.1:8080 -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, important scripts are included in the builder image: - -* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Node.js application development (see the **Environment variables** section below). -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull a base builder image to build on - -``` -podman pull ubi8/nodejs-20 -``` - -An UBI image `ubi8/nodejs-20` is used in this example. This image is usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-20 - -# Add application sources -ADD app-src . - -# Install the dependencies -RUN npm install - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-20 - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -**`NPM_TOKEN`** - Use authentication token for a custom NPM registry mirror - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/20/root/opt/app-root/etc/generate_container_user b/20/root/opt/app-root/etc/generate_container_user deleted file mode 100644 index b28a7a3d..00000000 --- a/20/root/opt/app-root/etc/generate_container_user +++ /dev/null @@ -1,17 +0,0 @@ -# Set current user in nss_wrapper -USER_ID=$(id -u) -GROUP_ID=$(id -g) - -if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then - - NSS_WRAPPER_PASSWD=/opt/app-root/etc/passwd - NSS_WRAPPER_GROUP=/etc/group - - cat /etc/passwd | sed -e 's/^default:/builder:/' > $NSS_WRAPPER_PASSWD - - echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD - - export NSS_WRAPPER_PASSWD - export NSS_WRAPPER_GROUP - export LD_PRELOAD=libnss_wrapper.so -fi diff --git a/20/root/opt/app-root/etc/npm_global_module_list b/20/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/20/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/20/root/opt/app-root/etc/scl_enable b/20/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/20/root/opt/app-root/etc/scl_enable +++ /dev/null @@ -1,3 +0,0 @@ -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/20/s2i/bin/assemble b/20/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/20/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/20/s2i/bin/init-wrapper b/20/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/20/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/20/s2i/bin/run b/20/s2i/bin/run deleted file mode 100755 index 9a207bce..00000000 --- a/20/s2i/bin/run +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -if [ -e "/opt/app-root/etc/generate_container_user" ]; then - source /opt/app-root/etc/generate_container_user -fi - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/20/s2i/bin/save-artifacts b/20/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/20/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/20/s2i/bin/usage b/20/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/20/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/20/test b/20/test deleted file mode 120000 index 419df4f9..00000000 --- a/20/test +++ /dev/null @@ -1 +0,0 @@ -../test \ No newline at end of file diff --git a/22-minimal/.exclude-c8s b/22-minimal/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/22-minimal/.exclude-c9s b/22-minimal/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/22-minimal/.exclude-fedora b/22-minimal/.exclude-fedora deleted file mode 100644 index e69de29b..00000000 diff --git a/22-minimal/Dockerfile.c10s b/22-minimal/Dockerfile.c10s deleted file mode 100644 index d041d0d5..00000000 --- a/22-minimal/Dockerfile.c10s +++ /dev/null @@ -1,67 +0,0 @@ -FROM quay.io/centos/centos:stream10-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el10" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c10s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n npm findutils tar which" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node-22 -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.c8s b/22-minimal/Dockerfile.c8s deleted file mode 100644 index d7829589..00000000 --- a/22-minimal/Dockerfile.c8s +++ /dev/null @@ -1,69 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - yum -y module disable nodejs && \ - yum -y module enable nodejs:$NODEJS_VERSION && \ - yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.c9s b/22-minimal/Dockerfile.c9s deleted file mode 100644 index 8d1d2c0b..00000000 --- a/22-minimal/Dockerfile.c9s +++ /dev/null @@ -1,69 +0,0 @@ -FROM quay.io/centos/centos:stream9-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - yum -y module disable nodejs && \ - yum -y module enable nodejs:$NODEJS_VERSION && \ - yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.fedora b/22-minimal/Dockerfile.fedora deleted file mode 100644 index 149c4955..00000000 --- a/22-minimal/Dockerfile.fedora +++ /dev/null @@ -1,71 +0,0 @@ -FROM quay.io/fedora/fedora-minimal:40 - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="fedora" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="fedora/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which nss_wrapper-libs" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - microdnf clean all && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -# -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.rhel10 b/22-minimal/Dockerfile.rhel10 deleted file mode 100644 index d341e59e..00000000 --- a/22-minimal/Dockerfile.rhel10 +++ /dev/null @@ -1,67 +0,0 @@ -FROM ubi10-minimal:latest - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el10" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi10/$NAME-$NODEJS_VERSION-minimal" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.rhel8 b/22-minimal/Dockerfile.rhel8 deleted file mode 100644 index 5f6d0bc3..00000000 --- a/22-minimal/Dockerfile.rhel8 +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubi8/ubi-minimal:latest - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/Dockerfile.rhel9 b/22-minimal/Dockerfile.rhel9 deleted file mode 100644 index 9a18e3ec..00000000 --- a/22-minimal/Dockerfile.rhel9 +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubi9/ubi-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/22-minimal/README.md b/22-minimal/README.md deleted file mode 100644 index ae2b7dd6..00000000 --- a/22-minimal/README.md +++ /dev/null @@ -1,376 +0,0 @@ -NodeJS 22 minimal container image -========================= - -This container image includes Node.JS 22 on top of a minimal base image for your Node.JS 22 applications. This image is designed to be used -with the full-sized s2i-enabled Node.JS 22 image to build the application. The image can be used as a standalone s2i-enabled image as well, -but compared to the full-sized Node.JS 22 image it will be missing many build-time dependencies. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 22 available as a minimal container is a base platform for -running various Node.js 22 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-22` image, available via `nodejs:22-ubi8` imagestream tag in Openshift -to build the application, as well as the `ubi8/nodejs-22-minimal` image, available via `nodejs:22-ubi8-minimal` image stream -for running the resulting application. - -With these two images we can create a [chained build](https://docs.openshift.com/container-platform/4.7/cicd/builds/advanced-build-operations.html#builds-chaining-builds_advanced-build-operations) in Openshift using two BuildConfigs: - -The first BuildConfig defines and builds the builder image, using the source-to-image strategy, and pushes the result into -the `nodejs-builder-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-builder-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-builder-image:latest - source: - git: - uri: https://github.com/sclorg/nodejs-ex.git - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: nodejs:22-ubi8 - namespace: openshift -``` - -The second BuildConfig takes the resulting image from the `nodejs-builder-image` imagestream, copies the application source (including build artifacts) -from the image and creates a new runtime image on top of the nodejs minimal image, with the application copied in and prepared to run. -The resulting runtime image is then pushed into the `nodejs-runtime-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-runtime-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-runtime-image:latest - source: - dockerfile: |- - FROM nodejs:22-ubi8-minimal - COPY src $HOME - CMD /usr/libexec/s2i/run - images: - - from: - kind: ImageStreamTag - name: nodejs-builder-image:latest - paths: - - sourcePath: /opt/app-root/src - destinationDir: "." - strategy: - dockerStrategy: - from: - kind: ImageStreamTag - name: nodejs:22-ubi8-minimal - triggers: - - imageChange: {} - type: ImageChange -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, only the `run` script is included in this image. - -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull the base builder and minimal runtime images - -``` -podman pull ubi8/nodejs-22 -podman pull ubi8/nodejs-22-minimal -``` - -The UBI images `ubi8/nodejs-22` and `ubi8/nodejs-22-minimal` that are used in this example are both usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-22 as builder - -# Add application sources -ADD app-src $HOME - -# Install the dependencies -RUN npm install - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-22-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-22 as builder - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-22-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -#### Used in the minimal image - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -#### Additional variables used in the full-sized image - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -**`NPM_TOKEN`** - Use authentication token for a custom NPM registry mirror - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -Dockerfile for CentOS Stream 10 is called `Dockerfile.c10s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for RHEL10 it's `Dockerfile.rhel10` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/22-minimal/root/usr/bin/fix-permissions b/22-minimal/root/usr/bin/fix-permissions deleted file mode 100755 index ddd33ace..00000000 --- a/22-minimal/root/usr/bin/fix-permissions +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Allow this script to fail without failing a build -set +e - -SYMLINK_OPT=${2:--L} - -# Fix permissions on the given directory or file to allow group read/write of -# regular files and execute of directories. - -[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)" - -# If argument does not exist, script will still exit with 0, -# but at least we'll see something went wrong in the log -if ! [ -e "$1" ] ; then - echo "ERROR: File or directory $1 does not exist." >&2 - # We still want to end successfully - exit 0 -fi - -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} + - -# Always end successfully -exit 0 diff --git a/22-minimal/s2i/bin/assemble b/22-minimal/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/22-minimal/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/22-minimal/s2i/bin/init-wrapper b/22-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/22-minimal/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/22-minimal/s2i/bin/run b/22-minimal/s2i/bin/run deleted file mode 100755 index 10150f34..00000000 --- a/22-minimal/s2i/bin/run +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/22-minimal/s2i/bin/save-artifacts b/22-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/22-minimal/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/22-minimal/s2i/bin/usage b/22-minimal/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/22-minimal/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/22-minimal/test/__init__.py b/22-minimal/test/__init__.py deleted file mode 120000 index d0f4746a..00000000 --- a/22-minimal/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -../../test/__init__.py \ No newline at end of file diff --git a/22-minimal/test/check_imagestreams.py b/22-minimal/test/check_imagestreams.py deleted file mode 120000 index 56bb2be7..00000000 --- a/22-minimal/test/check_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../common/check_imagestreams.py \ No newline at end of file diff --git a/22-minimal/test/conftest.py b/22-minimal/test/conftest.py deleted file mode 120000 index 3f2d7840..00000000 --- a/22-minimal/test/conftest.py +++ /dev/null @@ -1 +0,0 @@ -../../test/conftest.py \ No newline at end of file diff --git a/22-minimal/test/examples b/22-minimal/test/examples deleted file mode 120000 index da7b1965..00000000 --- a/22-minimal/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples/ \ No newline at end of file diff --git a/22-minimal/test/imagestreams b/22-minimal/test/imagestreams deleted file mode 120000 index 0dcbe9e0..00000000 --- a/22-minimal/test/imagestreams +++ /dev/null @@ -1 +0,0 @@ -../../imagestreams/ \ No newline at end of file diff --git a/22-minimal/test/run b/22-minimal/test/run deleted file mode 120000 index f446a740..00000000 --- a/22-minimal/test/run +++ /dev/null @@ -1 +0,0 @@ -../../test/run-minimal \ No newline at end of file diff --git a/22-minimal/test/run-openshift-remote-cluster b/22-minimal/test/run-openshift-remote-cluster deleted file mode 120000 index 1bffcba8..00000000 --- a/22-minimal/test/run-openshift-remote-cluster +++ /dev/null @@ -1 +0,0 @@ -../../test/run-openshift-remote-cluster \ No newline at end of file diff --git a/22-minimal/test/run-pytest b/22-minimal/test/run-pytest deleted file mode 120000 index efe32b48..00000000 --- a/22-minimal/test/run-pytest +++ /dev/null @@ -1 +0,0 @@ -../../test/run-pytest \ No newline at end of file diff --git a/22-minimal/test/test-app b/22-minimal/test/test-app deleted file mode 120000 index 6ba4f290..00000000 --- a/22-minimal/test/test-app +++ /dev/null @@ -1 +0,0 @@ -../../test/test-app \ No newline at end of file diff --git a/22-minimal/test/test-binary b/22-minimal/test/test-binary deleted file mode 120000 index cd7b631f..00000000 --- a/22-minimal/test/test-binary +++ /dev/null @@ -1 +0,0 @@ -../../test/test-binary \ No newline at end of file diff --git a/22-minimal/test/test-express-webapp b/22-minimal/test/test-express-webapp deleted file mode 120000 index 6a5bbd41..00000000 --- a/22-minimal/test/test-express-webapp +++ /dev/null @@ -1 +0,0 @@ -../../test/test-express-webapp \ No newline at end of file diff --git a/22-minimal/test/test-fips b/22-minimal/test/test-fips deleted file mode 120000 index fbe9489f..00000000 --- a/22-minimal/test/test-fips +++ /dev/null @@ -1 +0,0 @@ -../../test/test-fips \ No newline at end of file diff --git a/22-minimal/test/test-hw b/22-minimal/test/test-hw deleted file mode 120000 index ad784558..00000000 --- a/22-minimal/test/test-hw +++ /dev/null @@ -1 +0,0 @@ -../../test/test-hw \ No newline at end of file diff --git a/22-minimal/test/test-incremental b/22-minimal/test/test-incremental deleted file mode 120000 index 0a357b1f..00000000 --- a/22-minimal/test/test-incremental +++ /dev/null @@ -1 +0,0 @@ -../../test/test-incremental \ No newline at end of file diff --git a/22-minimal/test/test-lib-nodejs.sh b/22-minimal/test/test-lib-nodejs.sh deleted file mode 120000 index 8915d844..00000000 --- a/22-minimal/test/test-lib-nodejs.sh +++ /dev/null @@ -1 +0,0 @@ -../../test/test-lib-nodejs.sh \ No newline at end of file diff --git a/22-minimal/test/test-lib-openshift.sh b/22-minimal/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/22-minimal/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/22-minimal/test/test-lib-remote-openshift.sh b/22-minimal/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/22-minimal/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/22-minimal/test/test-lib.sh b/22-minimal/test/test-lib.sh deleted file mode 120000 index 1ac99b93..00000000 --- a/22-minimal/test/test-lib.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib.sh \ No newline at end of file diff --git a/22-minimal/test/test-openshift.yaml b/22-minimal/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/22-minimal/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/22-minimal/test/test_container_apps.py b/22-minimal/test/test_container_apps.py deleted file mode 120000 index 9870de8e..00000000 --- a/22-minimal/test/test_container_apps.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_apps.py \ No newline at end of file diff --git a/22-minimal/test/test_container_basics.py b/22-minimal/test/test_container_basics.py deleted file mode 120000 index b85dc139..00000000 --- a/22-minimal/test/test_container_basics.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_basics.py \ No newline at end of file diff --git a/22/.exclude-c8s b/22/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/22/.exclude-c9s b/22/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/22/.exclude-fedora b/22/.exclude-fedora deleted file mode 100644 index e69de29b..00000000 diff --git a/22/Dockerfile.c10s b/22/Dockerfile.c10s deleted file mode 100644 index 0cc8da62..00000000 --- a/22/Dockerfile.c10s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-22" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c10s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c10s:latest " - -# Package libatomic_ops was removed -RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - rm /usr/bin/node && ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - rm /usr/bin/npm && ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - rm /usr/bin/npx && ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.c8s b/22/Dockerfile.c8s deleted file mode 100644 index 6a7e0501..00000000 --- a/22/Dockerfile.c8s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.c9s b/22/Dockerfile.c9s deleted file mode 100644 index 0b47eefa..00000000 --- a/22/Dockerfile.c9s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-22" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " - -# Package libatomic_ops was removed -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.fedora b/22/Dockerfile.fedora deleted file mode 100644 index 49a16b05..00000000 --- a/22/Dockerfile.fedora +++ /dev/null @@ -1,74 +0,0 @@ -FROM quay.io/fedora/s2i-core:40 - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="fedora/$NAME-$NODEJS_VERSION" \ - version="$NODEJS_VERSION" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" - -RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image, including help file. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel10 b/22/Dockerfile.rhel10 deleted file mode 100644 index e00815cc..00000000 --- a/22/Dockerfile.rhel10 +++ /dev/null @@ -1,79 +0,0 @@ -FROM ubi10/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi10-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi10-nodejs-22" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi10/$NAME-$NODEJS_VERSION" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi10/$NAME-$NODEJS_VERSION " - -# Package libatomic_ops was removed -RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - rm /usr/bin/node && ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - rm /usr/bin/npm && ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - rm /usr/bin/npx && ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel8 b/22/Dockerfile.rhel8 deleted file mode 100644 index cca2a4e4..00000000 --- a/22/Dockerfile.rhel8 +++ /dev/null @@ -1,85 +0,0 @@ -FROM ubi8/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi8/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " - -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=/opt/rh/gcc-toolset-13/enable \ - ENV=/opt/rh/gcc-toolset-13/enable \ - PROMPT_COMMAND=". /opt/rh/gcc-toolset-13/enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel9 b/22/Dockerfile.rhel9 deleted file mode 100644 index 5a7097e8..00000000 --- a/22/Dockerfile.rhel9 +++ /dev/null @@ -1,79 +0,0 @@ -FROM ubi9/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi9/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " - -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/22/README.md b/22/README.md deleted file mode 100644 index c05cbbd4..00000000 --- a/22/README.md +++ /dev/null @@ -1,305 +0,0 @@ -NodeJS 22 container image -========================= - -This container image includes Node.JS 22 as a [S2I](https://github.com/openshift/source-to-image) base image for your Node.JS 22 applications. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 22 available as container is a base platform for -building and running various Node.js 22 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-22` image, available via `nodejs:22` imagestream tag in Openshift. - -To build a simple [nodejs-sample-app](https://github.com/sclorg/nodejs-ex.git) application in Openshift: - -``` -oc new-app nodejs:22~https://github.com/sclorg/nodejs-ex.git -``` - -To access the application: -``` -$ oc get pods -$ oc exec -- curl 127.0.0.1:8080 -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, important scripts are included in the builder image: - -* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Node.js application development (see the **Environment variables** section below). -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull a base builder image to build on - -``` -podman pull ubi8/nodejs-22 -``` - -An UBI image `ubi8/nodejs-22` is used in this example. This image is usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-22 - -# Add application sources -ADD app-src . - -# Install the dependencies -RUN npm install - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-22 - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -**`NPM_TOKEN`** - Use authentication token for a custom NPM registry mirror - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -Dockerfile for CentOS Stream 10 is called `Dockerfile.c10s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for RHEL10 it's `Dockerfile.rhel10` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/22/root/opt/app-root/etc/generate_container_user b/22/root/opt/app-root/etc/generate_container_user deleted file mode 100644 index b28a7a3d..00000000 --- a/22/root/opt/app-root/etc/generate_container_user +++ /dev/null @@ -1,17 +0,0 @@ -# Set current user in nss_wrapper -USER_ID=$(id -u) -GROUP_ID=$(id -g) - -if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then - - NSS_WRAPPER_PASSWD=/opt/app-root/etc/passwd - NSS_WRAPPER_GROUP=/etc/group - - cat /etc/passwd | sed -e 's/^default:/builder:/' > $NSS_WRAPPER_PASSWD - - echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD - - export NSS_WRAPPER_PASSWD - export NSS_WRAPPER_GROUP - export LD_PRELOAD=libnss_wrapper.so -fi diff --git a/22/root/opt/app-root/etc/npm_global_module_list b/22/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/22/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/22/root/opt/app-root/etc/scl_enable b/22/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/22/root/opt/app-root/etc/scl_enable +++ /dev/null @@ -1,3 +0,0 @@ -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/22/s2i/bin/assemble b/22/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/22/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/22/s2i/bin/init-wrapper b/22/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/22/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/22/s2i/bin/run b/22/s2i/bin/run deleted file mode 100755 index 9a207bce..00000000 --- a/22/s2i/bin/run +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -if [ -e "/opt/app-root/etc/generate_container_user" ]; then - source /opt/app-root/etc/generate_container_user -fi - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/22/s2i/bin/save-artifacts b/22/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/22/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/22/s2i/bin/usage b/22/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/22/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/22/test b/22/test deleted file mode 120000 index ae78e219..00000000 --- a/22/test +++ /dev/null @@ -1 +0,0 @@ -../test/ \ No newline at end of file diff --git a/24-minimal/.exclude-c8s b/24-minimal/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/24-minimal/.exclude-rhel8 b/24-minimal/.exclude-rhel8 deleted file mode 100644 index e69de29b..00000000 diff --git a/24-minimal/Dockerfile.c10s b/24-minimal/Dockerfile.c10s deleted file mode 100644 index dfe25b3c..00000000 --- a/24-minimal/Dockerfile.c10s +++ /dev/null @@ -1,70 +0,0 @@ -FROM quay.io/centos/centos:stream10-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el10" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c10s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - microdnf clean all && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.c8s b/24-minimal/Dockerfile.c8s deleted file mode 100644 index d7829589..00000000 --- a/24-minimal/Dockerfile.c8s +++ /dev/null @@ -1,69 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - yum -y module disable nodejs && \ - yum -y module enable nodejs:$NODEJS_VERSION && \ - yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.c9s b/24-minimal/Dockerfile.c9s deleted file mode 100644 index 5f2968c7..00000000 --- a/24-minimal/Dockerfile.c9s +++ /dev/null @@ -1,69 +0,0 @@ -FROM quay.io/centos/centos:stream9-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.fedora b/24-minimal/Dockerfile.fedora deleted file mode 100644 index aff5ae90..00000000 --- a/24-minimal/Dockerfile.fedora +++ /dev/null @@ -1,71 +0,0 @@ -FROM quay.io/fedora/fedora-minimal:42 - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="fedora" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="fedora/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - microdnf clean all && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -# -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.rhel10 b/24-minimal/Dockerfile.rhel10 deleted file mode 100644 index 242fa883..00000000 --- a/24-minimal/Dockerfile.rhel10 +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubi10-minimal:latest - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el10" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi10/$NAME-$NODEJS_VERSION-minimal" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - microdnf clean all && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.rhel8 b/24-minimal/Dockerfile.rhel8 deleted file mode 100644 index 56635add..00000000 --- a/24-minimal/Dockerfile.rhel8 +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubi8/ubi-minimal:latest - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el8" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/Dockerfile.rhel9 b/24-minimal/Dockerfile.rhel9 deleted file mode 100644 index 27247979..00000000 --- a/24-minimal/Dockerfile.rhel9 +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubi9/ubi-minimal - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application -ENV APP_ROOT=/opt/app-root \ - # The $HOME is not set by default, but some applications need this variable - HOME=/opt/app-root/src \ - NPM_RUN=start \ - PLATFORM="el9" \ - NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs - -ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ - name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" - -# nodejs-full-i18n is included for error strings -RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ - microdnf -y module disable nodejs && \ - microdnf -y module enable nodejs:$NODEJS_VERSION && \ - microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - microdnf clean all && \ - rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - -COPY ./s2i/bin/ /usr/libexec/s2i -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" -WORKDIR "$HOME" -USER 1001 diff --git a/24-minimal/README.md b/24-minimal/README.md deleted file mode 100644 index 824d8635..00000000 --- a/24-minimal/README.md +++ /dev/null @@ -1,376 +0,0 @@ -NodeJS 24 minimal container image -========================= - -This container image includes Node.JS 24 on top of a minimal base image for your Node.JS 24 applications. This image is designed to be used -with the full-sized s2i-enabled Node.JS 24 image to build the application. The image can be used as a standalone s2i-enabled image as well, -but compared to the full-sized Node.JS 24 image it will be missing many build-time dependencies. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 24 available as a minimal container is a base platform for -running various Node.js 24 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-24` image, available via `nodejs:24-ubi8` imagestream tag in Openshift -to build the application, as well as the `ubi8/nodejs-24-minimal` image, available via `nodejs:24-ubi8-minimal` image stream -for running the resulting application. - -With these two images we can create a [chained build](https://docs.openshift.com/container-platform/4.7/cicd/builds/advanced-build-operations.html#builds-chaining-builds_advanced-build-operations) in Openshift using two BuildConfigs: - -The first BuildConfig defines and builds the builder image, using the source-to-image strategy, and pushes the result into -the `nodejs-builder-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-builder-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-builder-image:latest - source: - git: - uri: https://github.com/sclorg/nodejs-ex.git - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: nodejs:24-ubi8 - namespace: openshift -``` - -The second BuildConfig takes the resulting image from the `nodejs-builder-image` imagestream, copies the application source (including build artifacts) -from the image and creates a new runtime image on top of the nodejs minimal image, with the application copied in and prepared to run. -The resulting runtime image is then pushed into the `nodejs-runtime-image` imagestream. - -``` -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: nodejs-runtime-image -spec: - output: - to: - kind: ImageStreamTag - name: nodejs-runtime-image:latest - source: - dockerfile: |- - FROM nodejs:24-ubi8-minimal - COPY src $HOME - CMD /usr/libexec/s2i/run - images: - - from: - kind: ImageStreamTag - name: nodejs-builder-image:latest - paths: - - sourcePath: /opt/app-root/src - destinationDir: "." - strategy: - dockerStrategy: - from: - kind: ImageStreamTag - name: nodejs:24-ubi8-minimal - triggers: - - imageChange: {} - type: ImageChange -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, only the `run` script is included in this image. - -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull the base builder and minimal runtime images - -``` -podman pull ubi8/nodejs-24 -podman pull ubi8/nodejs-24-minimal -``` - -The UBI images `ubi8/nodejs-24` and `ubi8/nodejs-24-minimal` that are used in this example are both usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-24 as builder - -# Add application sources -ADD app-src $HOME - -# Install the dependencies -RUN npm install - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-24-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -# First stage builds the application -FROM ubi8/nodejs-24 as builder - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Second stage copies the application to the minimal image -FROM ubi8/nodejs-24-minimal - -# Copy the application source and build artifacts from the builder image to this one -COPY --from=builder $HOME $HOME - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -#### Used in the minimal image - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -#### Additional variables used in the full-sized image - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -**`NPM_TOKEN`** - Use authentication token for a custom NPM registry mirror - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -Dockerfile for CentOS Stream 10 is called `Dockerfile.c10s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for RHEL10 it's `Dockerfile.rhel10` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/24-minimal/root/usr/bin/fix-permissions b/24-minimal/root/usr/bin/fix-permissions deleted file mode 100755 index ddd33ace..00000000 --- a/24-minimal/root/usr/bin/fix-permissions +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Allow this script to fail without failing a build -set +e - -SYMLINK_OPT=${2:--L} - -# Fix permissions on the given directory or file to allow group read/write of -# regular files and execute of directories. - -[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)" - -# If argument does not exist, script will still exit with 0, -# but at least we'll see something went wrong in the log -if ! [ -e "$1" ] ; then - echo "ERROR: File or directory $1 does not exist." >&2 - # We still want to end successfully - exit 0 -fi - -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} + -find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} + - -# Always end successfully -exit 0 diff --git a/24-minimal/s2i/bin/assemble b/24-minimal/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/24-minimal/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/24-minimal/s2i/bin/init-wrapper b/24-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/24-minimal/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/24-minimal/s2i/bin/run b/24-minimal/s2i/bin/run deleted file mode 100755 index 10150f34..00000000 --- a/24-minimal/s2i/bin/run +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/24-minimal/s2i/bin/save-artifacts b/24-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/24-minimal/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/24-minimal/s2i/bin/usage b/24-minimal/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/24-minimal/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/24-minimal/test/__init__.py b/24-minimal/test/__init__.py deleted file mode 120000 index d0f4746a..00000000 --- a/24-minimal/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -../../test/__init__.py \ No newline at end of file diff --git a/24-minimal/test/check_imagestreams.py b/24-minimal/test/check_imagestreams.py deleted file mode 120000 index 56bb2be7..00000000 --- a/24-minimal/test/check_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../common/check_imagestreams.py \ No newline at end of file diff --git a/24-minimal/test/conftest.py b/24-minimal/test/conftest.py deleted file mode 120000 index 3f2d7840..00000000 --- a/24-minimal/test/conftest.py +++ /dev/null @@ -1 +0,0 @@ -../../test/conftest.py \ No newline at end of file diff --git a/24-minimal/test/examples b/24-minimal/test/examples deleted file mode 120000 index da7b1965..00000000 --- a/24-minimal/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples/ \ No newline at end of file diff --git a/24-minimal/test/imagestreams b/24-minimal/test/imagestreams deleted file mode 120000 index 0dcbe9e0..00000000 --- a/24-minimal/test/imagestreams +++ /dev/null @@ -1 +0,0 @@ -../../imagestreams/ \ No newline at end of file diff --git a/24-minimal/test/run b/24-minimal/test/run deleted file mode 120000 index f446a740..00000000 --- a/24-minimal/test/run +++ /dev/null @@ -1 +0,0 @@ -../../test/run-minimal \ No newline at end of file diff --git a/24-minimal/test/run-openshift-remote-cluster b/24-minimal/test/run-openshift-remote-cluster deleted file mode 120000 index 1bffcba8..00000000 --- a/24-minimal/test/run-openshift-remote-cluster +++ /dev/null @@ -1 +0,0 @@ -../../test/run-openshift-remote-cluster \ No newline at end of file diff --git a/24-minimal/test/run-pytest b/24-minimal/test/run-pytest deleted file mode 120000 index efe32b48..00000000 --- a/24-minimal/test/run-pytest +++ /dev/null @@ -1 +0,0 @@ -../../test/run-pytest \ No newline at end of file diff --git a/24-minimal/test/test-app b/24-minimal/test/test-app deleted file mode 120000 index 6ba4f290..00000000 --- a/24-minimal/test/test-app +++ /dev/null @@ -1 +0,0 @@ -../../test/test-app \ No newline at end of file diff --git a/24-minimal/test/test-binary b/24-minimal/test/test-binary deleted file mode 120000 index cd7b631f..00000000 --- a/24-minimal/test/test-binary +++ /dev/null @@ -1 +0,0 @@ -../../test/test-binary \ No newline at end of file diff --git a/24-minimal/test/test-express-webapp b/24-minimal/test/test-express-webapp deleted file mode 120000 index 6a5bbd41..00000000 --- a/24-minimal/test/test-express-webapp +++ /dev/null @@ -1 +0,0 @@ -../../test/test-express-webapp \ No newline at end of file diff --git a/24-minimal/test/test-fips b/24-minimal/test/test-fips deleted file mode 120000 index fbe9489f..00000000 --- a/24-minimal/test/test-fips +++ /dev/null @@ -1 +0,0 @@ -../../test/test-fips \ No newline at end of file diff --git a/24-minimal/test/test-hw b/24-minimal/test/test-hw deleted file mode 120000 index ad784558..00000000 --- a/24-minimal/test/test-hw +++ /dev/null @@ -1 +0,0 @@ -../../test/test-hw \ No newline at end of file diff --git a/24-minimal/test/test-incremental b/24-minimal/test/test-incremental deleted file mode 120000 index 0a357b1f..00000000 --- a/24-minimal/test/test-incremental +++ /dev/null @@ -1 +0,0 @@ -../../test/test-incremental \ No newline at end of file diff --git a/24-minimal/test/test-lib-nodejs.sh b/24-minimal/test/test-lib-nodejs.sh deleted file mode 120000 index 8915d844..00000000 --- a/24-minimal/test/test-lib-nodejs.sh +++ /dev/null @@ -1 +0,0 @@ -../../test/test-lib-nodejs.sh \ No newline at end of file diff --git a/24-minimal/test/test-lib-openshift.sh b/24-minimal/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/24-minimal/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/24-minimal/test/test-lib-remote-openshift.sh b/24-minimal/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/24-minimal/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/24-minimal/test/test-lib.sh b/24-minimal/test/test-lib.sh deleted file mode 120000 index 1ac99b93..00000000 --- a/24-minimal/test/test-lib.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib.sh \ No newline at end of file diff --git a/24-minimal/test/test-openshift.yaml b/24-minimal/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/24-minimal/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/24-minimal/test/test_container_apps.py b/24-minimal/test/test_container_apps.py deleted file mode 120000 index 9870de8e..00000000 --- a/24-minimal/test/test_container_apps.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_apps.py \ No newline at end of file diff --git a/24-minimal/test/test_container_basics.py b/24-minimal/test/test_container_basics.py deleted file mode 120000 index b85dc139..00000000 --- a/24-minimal/test/test_container_basics.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_container_basics.py \ No newline at end of file diff --git a/24/.exclude-c8s b/24/.exclude-c8s deleted file mode 100644 index e69de29b..00000000 diff --git a/24/.exclude-rhel8 b/24/.exclude-rhel8 deleted file mode 100644 index e69de29b..00000000 diff --git a/24/Dockerfile.c10s b/24/Dockerfile.c10s deleted file mode 100644 index 527c8907..00000000 --- a/24/Dockerfile.c10s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-24" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c10s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c10s:latest " - -# Package libatomic_ops was removed -RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.c8s b/24/Dockerfile.c8s deleted file mode 100644 index 6a7e0501..00000000 --- a/24/Dockerfile.c8s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c8s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.c9s b/24/Dockerfile.c9s deleted file mode 100644 index f297ee4f..00000000 --- a/24/Dockerfile.c9s +++ /dev/null @@ -1,80 +0,0 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-24" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " - -# Package libatomic_ops was removed -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.fedora b/24/Dockerfile.fedora deleted file mode 100644 index 1880a2ed..00000000 --- a/24/Dockerfile.fedora +++ /dev/null @@ -1,74 +0,0 @@ -FROM quay.io/fedora/s2i-core:42 - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="fedora/$NAME-$NODEJS_VERSION" \ - version="$NODEJS_VERSION" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" - -RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image, including help file. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.rhel10 b/24/Dockerfile.rhel10 deleted file mode 100644 index a2954241..00000000 --- a/24/Dockerfile.rhel10 +++ /dev/null @@ -1,79 +0,0 @@ -FROM ubi10/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi10-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi10-nodejs-24" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi10/$NAME-$NODEJS_VERSION" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi10/$NAME-$NODEJS_VERSION " - -# Package libatomic_ops was removed -RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ - ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ - ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.rhel8 b/24/Dockerfile.rhel8 deleted file mode 100644 index d5cc39de..00000000 --- a/24/Dockerfile.rhel8 +++ /dev/null @@ -1,85 +0,0 @@ -FROM ubi8/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi8/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " - -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Enable the SCL for all bash scripts. -ENV BASH_ENV=/opt/rh/gcc-toolset-13/enable \ - ENV=/opt/rh/gcc-toolset-13/enable \ - PROMPT_COMMAND=". /opt/rh/gcc-toolset-13/enable" - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.rhel9 b/24/Dockerfile.rhel9 deleted file mode 100644 index 74202d63..00000000 --- a/24/Dockerfile.rhel9 +++ /dev/null @@ -1,79 +0,0 @@ -FROM ubi9/s2i-core:latest - -# This image provides a Node.JS environment you can use to run your Node.JS -# applications. - -EXPOSE 8080 - -# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts -# available on the CLI without using npm's --global installation mode -# This image will be initialized with "npm run $NPM_RUN" -# See https://docs.npmjs.com/misc/scripts, and your repo's package.json -# file for possible values of NPM_RUN -# Description -# Environment: -# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). -# Expose ports: -# * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ - NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 - -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ - DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ -Node.js is a platform built on Chrome's JavaScript runtime for easily building \ -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ -that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ - io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-20" \ - com.redhat.dev-mode="DEV_MODE:false" \ - com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ - name="ubi9/$NAME-$NODEJS_VERSION" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " - -RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ - MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ - 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 && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/24/README.md b/24/README.md deleted file mode 100644 index 241d1173..00000000 --- a/24/README.md +++ /dev/null @@ -1,305 +0,0 @@ -NodeJS 24 container image -========================= - -This container image includes Node.JS 24 as a [S2I](https://github.com/openshift/source-to-image) base image for your Node.JS 24 applications. -Users can choose between RHEL, CentOS and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). -the CentOS Stream images are available in the [Quay.io](https://quay.io/organization/sclorg), -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments - -Description ------------ - -Node.js 24 available as container is a base platform for -building and running various Node.js 24 applications and frameworks. -Node.js is a platform built on Chrome's JavaScript runtime for easily building -fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model -that makes it lightweight and efficient, perfect for data-intensive real-time applications -that run across distributed devices. - -Usage in OpenShift ------------------- -In this example, we will assume that you are using the `ubi8/nodejs-24` image, available via `nodejs:24` imagestream tag in Openshift. - -To build a simple [nodejs-sample-app](https://github.com/sclorg/nodejs-ex.git) application in Openshift: - -``` -oc new-app nodejs:24~https://github.com/sclorg/nodejs-ex.git -``` - -To access the application: -``` -$ oc get pods -$ oc exec -- curl 127.0.0.1:8080 -``` - -Source-to-Image framework and scripts -------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) -(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework -which makes it easy to write images that take application source code as -an input, use a builder image like this Node.js container image, and produce -a new image that runs the assembled application as an output. - -To support the Source-to-Image framework, important scripts are included in the builder image: - -* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Node.js application development (see the **Environment variables** section below). -* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `npm run` for production, or `nodemon` if `DEV_MODE` is set to `true` (see the **Environment variables** section below). - -Building an application using a Dockerfile ------------------------------------------- -Compared to the Source-to-Image strategy, using a Dockerfile is a more -flexible way to build a Node.js container image with an application. -Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or -when you build the image outside of the OpenShift environment. - -To use the Node.js image in a Dockerfile, follow these steps: - -#### 1. Pull a base builder image to build on - -``` -podman pull ubi8/nodejs-24 -``` - -An UBI image `ubi8/nodejs-24` is used in this example. This image is usable and freely redistributable under the terms of the UBI End User License Agreement (EULA). See more about UBI at [UBI FAQ](https://developers.redhat.com/articles/ubi-faq). - -#### 2. Pull an application code - -An example application available at https://github.com/sclorg/nodejs-ex.git is used here. Feel free to clone the repository for further experiments. - -``` -git clone https://github.com/sclorg/nodejs-ex.git app-src -``` - -#### 3. Prepare an application inside a container - -This step usually consists of at least these parts: - -* putting the application source into the container -* installing the dependencies -* setting the default command in the resulting image - -For all these three parts, users can either setup all manually and use commands `nodejs` and `npm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Node.js applications. - -##### 3.1. To use your own setup, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-24 - -# Add application sources -ADD app-src . - -# Install the dependencies -RUN npm install - -# Run script uses standard ways to run the application -CMD npm run -d start -``` - -##### 3.2. To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: -``` -FROM ubi8/nodejs-24 - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 -ADD app-src /tmp/src -RUN chown -R 1001:0 /tmp/src -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run -``` - -#### 4. Build a new image from a Dockerfile prepared in the previous step - -``` -podman build -t node-app . -``` - -#### 5. Run the resulting image with the final application - -``` -podman run -d node-app -``` - -Environment variables for Source-to-Image ---------------------- - -Application developers can use the following environment variables to configure the runtime behavior of this image in OpenShift: - -**`NODE_ENV`** - NodeJS runtime mode (default: "production") - -**`DEV_MODE`** - When set to "true", `nodemon` will be used to automatically reload the server while you work (default: "false"). Setting `DEV_MODE` to "true" will change the `NODE_ENV` default to "development" (if not explicitly set). - -**`NPM_BUILD`** - Select an alternate / custom build command, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "build"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`NODE_CMD`** - When specified (e.g.Specify `NODE_CMD="node server.js"`) the value of `NODE_CMD` is used to start the application instead of `npm start`. - -**`INIT_WRAPPER`** - When set to "true", the application is started via the `init-wrapper` script instead of using `npm start`, by looking for the presence of the files `server.js`, `index.js` or `main.js` in the order in which they are listed. In case of `NODE_CMD` environemnt variale is specified, then `init-wrapper` script will use the value of `NODE_CMD` to start your application. - -**`NPM_RUN`** - Select an alternate / custom runtime mode, defined in your `package.json` file's [`scripts`](https://docs.npmjs.com/misc/scripts) section (default: npm run "start"). These user-defined run-scripts are unavailable while `DEV_MODE` is in use. - -**`HTTP_PROXY`** - Use an npm proxy during assembly - -**`HTTPS_PROXY`** - Use an npm proxy during assembly - -**`NPM_MIRROR`** - Use a custom NPM registry mirror to download packages during the build process - -**`NPM_TOKEN`** - Use authentication token for a custom NPM registry mirror - -One way to define a set of environment variables is to include them as key value pairs in your repo's `.s2i/environment` file. - -Example: DATABASE_USER=sampleUser - -#### NOTE: Define your own "`DEV_MODE`": - -The following `package.json` example includes a `scripts.dev` entry. You can define your own custom [`NPM_RUN`](https://docs.npmjs.com/cli/run-script) scripts in your application's `package.json` file. - -#### Note: Setting logging output verbosity -To alter the level of logs output during an `npm install` the npm_config_loglevel environment variable can be set. See [npm-config](https://docs.npmjs.com/misc/config). - -Development Mode ----------------- -This image supports development mode. This mode can be switched on and off with the environment variable `DEV_MODE`. `DEV_MODE` can either be set to `true` or `false`. -Development mode supports two features: -* Hot Deploy -* Debugging - -The debug port can be specified with the environment variable `DEBUG_PORT`. `DEBUG_PORT` is only valid if `DEV_MODE=true`. - -A simple example command for running the container in development mode is: -``` -podman run --env DEV_MODE=true my-image-id -``` - -To run the container in development mode with a debug port of 5454, run: -``` -$ podman run --env DEV_MODE=true DEBUG_PORT=5454 my-image-id -``` - -To run the container in production mode, run: -``` -$ podman run --env DEV_MODE=false my-image-id -``` - -By default, `DEV_MODE` is set to `false`, and `DEBUG_PORT` is set to `5858`, however the `DEBUG_PORT` is only relevant if `DEV_MODE=true`. - -Hot deploy ----------- - -As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application. - -### Using Podman's exec - -To change your source code in a running container, use Podman's [exec](https://github.com/containers/libpod) command: -``` -$ podman exec -it /bin/bash -``` - -After you [Podman exec](https://github.com/containers/libpod) into the running container, your current directory is set to `/opt/app-root/src`, where the source code for your application is located. - -### Using OpenShift's rsync - -If you have deployed the container to OpenShift, you can use [oc rsync](https://docs.openshift.org/latest/dev_guide/copy_files_to_container.html) to copy local files to a remote container running in an OpenShift pod. - -#### Warning: - -The default behaviour of the s2i-nodejs container image is to run the Node.js application using the command `npm start`. This runs the _start_ script in the _package.json_ file. In developer mode, the application is run using the command `nodemon`. The default behaviour of nodemon is to look for the _main_ attribute in the _package.json_ file, and execute that script. If the _main_ attribute doesn't appear in the _package.json_ file, it executes the _start_ script. So, in order to achieve some sort of uniform functionality between production and development modes, the user should remove the _main_ attribute. - -Below is an example _package.json_ file with the _main_ attribute and _start_ script marked appropriately: - -```json -{ - "name": "node-echo", - "version": "0.0.1", - "description": "node-echo", - "main": "example.js", <--- main attribute - "dependencies": { - }, - "devDependencies": { - "nodemon": "*" - }, - "engine": { - "node": "*", - "npm": "*" - }, - "scripts": { - "dev": "nodemon --ignore node_modules/ server.js", - "start": "node server.js" <-- start script - }, - "keywords": [ - "Echo" - ], - "license": "", -} -``` - -#### Note: -`oc rsync` is only available in versions 3.1+ of OpenShift. - -## init-wrapper - -init-wrapper script is located on `/usr/libexec/s2i/init-wrapper` and is used to handle: - -- Proper signal handling and propagation, as Node.js was not designed to run as PID 1. -- Reaping zombie child processes -Avoiding use of npm, there is more information on why you want to avoid that in the [Node.js reference architecture](https://github.com/nodeshift/nodejs-reference-architecture/blob/e4c4dc1fd20c2cac392e862859aaad27f85d504f/docs/development/building-good-containers.md#avoiding-using-npm-to-start-application). When the INIT_WRAPPER is set to true the application is started via the init script instead of using npm start. - -A detailed explanation on how the init-wrapper script works is avalable in -[this url](http://veithen.io/2014/11/16/sigterm-propagation.html). - -Example of using init-wrapper: - -**During image build** -``` -s2i -e INIT_WRAPPER=true build . buildImage node-app -docker run node-app -``` -**During container start** -``` -s2i build . buildImage node-app -docker run -e INIT_WRAPPER=true node-app -``` - -`init-wrapper` script can be disabled by setting the `INIT_WRAPPER` env variable to `false`. - -``` -docker run -e INIT_WRAPPER=false node-app -``` -`NODE_CMD` can be used during the build process or container start, in order to have more control on the command that `init-wrapper` script will wrap. - -For example: - -**during container build** -``` -s2i -e INIT_WRAPPER=true -e NODE_CMD="node index.js" build . buildImage node-app -``` -**during container start** -``` -docker run -e INIT_WRAPPER=false -e NODE_CMD="node index.js" node-app -``` - -See also --------- -Dockerfile and other sources are available on https://github.com/sclorg/s2i-nodejs-container. -In that repository you also can find another versions of Node.js environment Dockerfiles. -Dockerfile for CentOS Stream 9 is called `Dockerfile.c9s`, -Dockerfile for CentOS Stream 10 is called `Dockerfile.c10s`, -for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for RHEL10 it's `Dockerfile.rhel10` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/24/root/opt/app-root/etc/generate_container_user b/24/root/opt/app-root/etc/generate_container_user deleted file mode 100644 index b28a7a3d..00000000 --- a/24/root/opt/app-root/etc/generate_container_user +++ /dev/null @@ -1,17 +0,0 @@ -# Set current user in nss_wrapper -USER_ID=$(id -u) -GROUP_ID=$(id -g) - -if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then - - NSS_WRAPPER_PASSWD=/opt/app-root/etc/passwd - NSS_WRAPPER_GROUP=/etc/group - - cat /etc/passwd | sed -e 's/^default:/builder:/' > $NSS_WRAPPER_PASSWD - - echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD - - export NSS_WRAPPER_PASSWD - export NSS_WRAPPER_GROUP - export LD_PRELOAD=libnss_wrapper.so -fi diff --git a/24/root/opt/app-root/etc/npm_global_module_list b/24/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/24/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/24/root/opt/app-root/etc/scl_enable b/24/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/24/root/opt/app-root/etc/scl_enable +++ /dev/null @@ -1,3 +0,0 @@ -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/24/s2i/bin/assemble b/24/s2i/bin/assemble deleted file mode 100755 index 3230d038..00000000 --- a/24/s2i/bin/assemble +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Prevent running assemble in builders different than official STI image. -# The official nodejs:8-onbuild already run npm install and use different -# application folder. -[ -d "/usr/src/app" ] && exit 0 - -set -e - -# FIXME: Linking of global modules is disabled for now as it causes npm failures -# under RHEL7 -# Global modules good to have -# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) -# Available global modules; only match top-level npm packages -#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) -# List all modules in common -#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') -# Link the modules -#npm link $module_list - -safeLogging () { - if [[ $1 =~ http[s]?://.*@.*$ ]]; then - echo $1 | sed 's/^.*@/redacted@/' - else - echo $1 - fi -} - -shopt -s dotglob -if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring previous build artifacts ..." - mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" -fi - -echo "---> Installing application source ..." -mv /tmp/src/* ./ - -# Fix source directory permissions -fix-permissions ./ - -if [ ! -z $HTTP_PROXY ]; then - echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) - npm config set proxy $HTTP_PROXY -fi - -if [ ! -z $http_proxy ]; then - echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) - npm config set proxy $http_proxy -fi - -if [ ! -z $HTTPS_PROXY ]; then - echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) - npm config set https-proxy $HTTPS_PROXY -fi - -if [ ! -z $https_proxy ]; then - echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) - npm config set https-proxy $https_proxy -fi - -# Change the npm registry mirror if provided -if [ -n "$NPM_MIRROR" ]; then - npm config set registry $NPM_MIRROR -fi - -# Change the npm authentication token if provided -if [ -n "$NPM_TOKEN" ]; then - echo "---> Setting npm authentication token for $NPM_MIRROR" - INTERNAL_NPM_REGISTRY=$(echo "$NPM_MIRROR" | sed -n 's|https://||p') - npm config set "//${INTERNAL_NPM_REGISTRY:-registry.npmjs.org}:_auth" $NPM_TOKEN -fi - -# Set the DEV_MODE to false by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -if [ "$NODE_ENV" != "production" ]; then - - echo "---> Building your Node application from source" - npm install - -else - - echo "---> Installing all dependencies" - NODE_ENV=development npm install - - #do not fail when there is no build script - echo "---> Building in production mode" - npm run ${NPM_BUILD:-build} --if-present - - echo "---> Pruning the development dependencies" - npm prune - - NPM_TMP=$(npm config get tmp) - if ! mountpoint $NPM_TMP; then - echo "---> Cleaning the $NPM_TMP/npm-*" - rm -rf $NPM_TMP/npm-* - fi - - # Clear the npm's cache and tmp directories only if they are not a docker volumes - NPM_CACHE=$(npm config get cache) - if ! mountpoint $NPM_CACHE; then - echo "---> Cleaning the npm cache $NPM_CACHE" - #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory - # instead of $NPM_CACHE* use $NPM_CACHE/*. - # We do not want to delete .npmrc file. - rm -rf "${NPM_CACHE:?}/" - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/24/s2i/bin/init-wrapper b/24/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/24/s2i/bin/init-wrapper +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html -# Set a trap to kill the main app process when this -# init script receives SIGTERM or SIGINT -trap 'kill -s TERM $PID' TERM INT -# Execute the main application in the background -"$@" & -PID=$! -# wait command always terminates when trap is caught, even if the process hasn't finished yet -wait $PID -# Remove the trap and wait till the app process finishes completely -trap - TERM INT -# We wait again, since the first wait terminates when trap is caught -wait $PID -# Exit with the exit code of the app process -STATUS=$? -exit $STATUS \ No newline at end of file diff --git a/24/s2i/bin/run b/24/s2i/bin/run deleted file mode 100755 index 9a207bce..00000000 --- a/24/s2i/bin/run +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# S2I run script for the 'nodejs' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -set -e - -if [ -e "/opt/app-root/etc/generate_container_user" ]; then - source /opt/app-root/etc/generate_container_user -fi - -# Runs the nodejs application server. If the container is run in development mode, -# hot deploy and debugging are enabled. -run_node() { - echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" - if [ "$DEV_MODE" == true ]; then - echo "Launching via nodemon..." - exec nodemon --inspect="$DEBUG_PORT" - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD - elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then - echo "Launching via ${NODE_CMD}" - exec $NODE_CMD - elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then - - package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) - package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) - - if [ -n "$package_json_start" ]; then - start_command=$package_json_start - elif [ -n $package_json_main ]; then - start_command="node ." - elif [ -f "server.js" ]; then - start_command="node server.js" - else - echo "Failed to find file for starting the Node.js application" - exit 1 - fi - echo "launching via init wrapper..." - exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command - else - echo "Launching via npm..." - exec npm run -d $NPM_RUN - fi -} - -#Set the debug port to 5858 by default. -if [ -z "$DEBUG_PORT" ]; then - export DEBUG_PORT=5858 -fi - -# Set the environment to development by default. -if [ -z "$DEV_MODE" ]; then - export DEV_MODE=false -fi - -# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether -# the container is run in development mode. -if [ -z "$NODE_ENV" ]; then - if [ "$DEV_MODE" == true ]; then - export NODE_ENV=development - else - export NODE_ENV=production - fi -fi - -# If the official dockerhub node image is used, skip the SCL setup below -# and just run the nodejs server -if [ -d "/usr/src/app" ]; then - run_node -fi - -# Allow users to inspect/debug the builder image itself, by using: -# $ docker run -i -t openshift/centos-nodejs-builder --debug -# -[ "$1" == "--debug" ] && exec /bin/bash - -run_node diff --git a/24/s2i/bin/save-artifacts b/24/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/24/s2i/bin/save-artifacts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then - tar -C "${HOME}" -cf - node_modules -fi diff --git a/24/s2i/bin/usage b/24/s2i/bin/usage deleted file mode 100755 index b8c1dca8..00000000 --- a/24/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat < nodejs-sample-app - -You can then run the resulting image via: -podman run -p 8080:8080 nodejs-sample-app -EOF diff --git a/24/test b/24/test deleted file mode 120000 index ae78e219..00000000 --- a/24/test +++ /dev/null @@ -1 +0,0 @@ -../test/ \ No newline at end of file From 591f4fa86d76995fb4c986ae30ace1fea101abca Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Thu, 23 Apr 2026 17:10:12 +0200 Subject: [PATCH 4/9] Adjustments to manifest --- specs/multispec.yml | 67 ++++------ src/Dockerfile | 32 ++--- src/Dockerfile.fedora | 4 +- src/Dockerfile.minimal | 88 +++++++++++++ src/Dockerfile.minimal.fedora | 74 +++++++++++ .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + src/root/opt/app-root/etc/scl_enable | 3 + src/s2i/bin/assemble | 116 ++++++++++++++++++ src/s2i/bin/init-wrapper | 18 +++ src/s2i/bin/run | 83 +++++++++++++ src/s2i/bin/save-artifacts | 5 + src/s2i/bin/usage | 15 +++ 13 files changed, 467 insertions(+), 60 deletions(-) create mode 100644 src/Dockerfile.minimal create mode 100644 src/Dockerfile.minimal.fedora create mode 100644 src/root/opt/app-root/etc/generate_container_user create mode 100644 src/root/opt/app-root/etc/npm_global_module_list create mode 100644 src/root/opt/app-root/etc/scl_enable create mode 100755 src/s2i/bin/assemble create mode 100644 src/s2i/bin/init-wrapper create mode 100755 src/s2i/bin/run create mode 100755 src/s2i/bin/save-artifacts create mode 100755 src/s2i/bin/usage diff --git a/specs/multispec.yml b/specs/multispec.yml index 588541b4..994d0c07 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -2,17 +2,6 @@ version: 1 specs: distroinfo: - fedora42: - distros: - - fedora-42-x86_64 - s2i_base: quay.io/fedora/s2i-core - org: "fedora" - prod: "fedora" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" - pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - latest_fedora: "42" - fedora43: distros: - fedora-43-x86_64 @@ -24,28 +13,6 @@ specs: pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" latest_fedora: "43" - fedora44: - distros: - - fedora-44-x86_64 - s2i_base: quay.io/fedora/s2i-core - org: "fedora" - prod: "fedora" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" - pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - latest_fedora: "44" - - fedora45: - distros: - - fedora-45-x86_64 - s2i_base: quay.io/fedora/s2i-core - org: "fedora" - prod: "fedora" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" - pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - latest_fedora: "45" - rhel8: distros: - rhel-8-x86_64 @@ -96,6 +63,7 @@ specs: c10s: distros: - centos-stream-10-x86_64 + - fedora-43-x86_64 s2i_base: quay.io/sclorg/s2i-core-c10s:c10s org: "sclorg" prod: "c10s" @@ -168,10 +136,7 @@ matrix: - rhel-10-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - - fedora-42-x86_64 - fedora-43-x86_64 - - fedora-44-x86_64 - - fedora-45-x86_64 - version: "22" distros: - rhel-8-x86_64 @@ -179,10 +144,7 @@ matrix: - rhel-10-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - - fedora-42-x86_64 - fedora-43-x86_64 - - fedora-44-x86_64 - - fedora-45-x86_64 - version: "24" distros: - rhel-8-x86_64 @@ -190,7 +152,28 @@ matrix: - rhel-10-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - - fedora-42-x86_64 - fedora-43-x86_64 - - fedora-44-x86_64 - - fedora-45-x86_64 + - version: "20-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 + - version: "22-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 + - version: "24-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile index 94309ec5..32f86025 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ spec.s2i_base }}:latest +FROM {{ config.s2i_base }}:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,8 +20,8 @@ ENV NODEJS_VERSION={{ spec.version }} \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.distroinfo.redhat_component %} \ - CNB_STACK_ID=com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }} \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if config.redhat_component %} \ + CNB_STACK_ID=com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }} \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0{% endif %} @@ -40,24 +40,24 @@ LABEL summary="$SUMMARY" \ io.openshift.expose-services="8080:http" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.distroinfo.redhat_component %} \ - io.buildpacks.stack.id="com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }}"{% endif %} \ + io.s2i.scripts-url="image:///usr/libexec/s2i"{% if config.redhat_component %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }}"{% endif %} \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.distroinfo.redhat_component %} \ - com.redhat.component="{{ spec.distroinfo.redhat_component }}" \{% endif %} - name="{{ spec.distroinfo.img_name }}" \ - version="{% if spec.distroinfo.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.distroinfo.redhat_component %} \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if config.redhat_component %} \ + com.redhat.component="{{ config.redhat_component }}" \{% endif %} + name="{{ config.img_name }}" \ + version="{% if config.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if config.redhat_component %} \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="{% if spec.distroinfo.redhat_component %}s2i build {{ spec.distroinfo.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" + usage="{% if config.redhat_component %}s2i build {{ config.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" -{% if spec.distroinfo.environment_setup %} -RUN {{ spec.distroinfo.environment_setup }}{% endif %} +{% if config.environment_setup %} +RUN {{ config.environment_setup }}{% endif %} MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS {{ spec.distroinfo.pkgs }}" && \ -{% if spec.distroinfo.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + INSTALL_PKGS="$MODULE_DEPS {{ config.pkgs }}" && \ +{% if config.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ @@ -68,9 +68,9 @@ RUN {{ spec.distroinfo.environment_setup }}{% endif %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} - yum -y clean all --enablerepo='*'{% if spec.distroinfo.post_install %} + yum -y clean all --enablerepo='*'{% if config.post_install %} -RUN {{ spec.distroinfo.post_install }}{% endif %} +RUN {{ config.post_install }}{% endif %} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/src/Dockerfile.fedora b/src/Dockerfile.fedora index 397ecbe8..3f30c3eb 100644 --- a/src/Dockerfile.fedora +++ b/src/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM {{ spec.s2i_base }}:{{ spec.latest_fedora | default("42") }} +FROM {{ config.s2i_base }}:{{ spec.latest_fedora | default("42") }} # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="{{ spec.distroinfo.img_name }}" \ + name="{{ config.img_name }}" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ diff --git a/src/Dockerfile.minimal b/src/Dockerfile.minimal new file mode 100644 index 00000000..03bf0e2b --- /dev/null +++ b/src/Dockerfile.minimal @@ -0,0 +1,88 @@ +FROM {{ config.s2i_base }}:latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION={{ spec.version }} \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if config.redhat_component %} \ + CNB_STACK_ID=com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }} \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0{% endif %} + +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i"{% if config.redhat_component %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }}"{% endif %} \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if config.redhat_component %} \ + com.redhat.component="{{ config.redhat_component }}" \{% endif %} + name="{{ config.img_name }}-minimal" \ + version="{% if config.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if config.redhat_component %} \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="{% if config.redhat_component %}s2i build {{ config.img_name }}-minimal:latest {% else %}oc new-app $FGC/$NAME-minimal~{% endif %}" + +{% if config.environment_setup %} +RUN {{ config.environment_setup }}{% endif %} + INSTALL_PKGS="{{ config.pkgs }}" && \ +{% if config.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% else %} ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} + yum -y clean all --enablerepo='*'{% if config.post_install %} + +RUN {{ config.post_install }}{% endif %} + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/src/Dockerfile.minimal.fedora b/src/Dockerfile.minimal.fedora new file mode 100644 index 00000000..08f5f0f8 --- /dev/null +++ b/src/Dockerfile.minimal.fedora @@ -0,0 +1,74 @@ +FROM {{ config.s2i_base }}:43 + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION={{ config.version }} \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"\ + com.redhat.component="$NAME" \ + name="{{ config.img_name }}-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x /usr/libexec/s2i/init-wrapper + +# Copy extra files to the image, including help file. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/src/root/opt/app-root/etc/generate_container_user b/src/root/opt/app-root/etc/generate_container_user new file mode 100644 index 00000000..b28a7a3d --- /dev/null +++ b/src/root/opt/app-root/etc/generate_container_user @@ -0,0 +1,17 @@ +# Set current user in nss_wrapper +USER_ID=$(id -u) +GROUP_ID=$(id -g) + +if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then + + NSS_WRAPPER_PASSWD=/opt/app-root/etc/passwd + NSS_WRAPPER_GROUP=/etc/group + + cat /etc/passwd | sed -e 's/^default:/builder:/' > $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/src/root/opt/app-root/etc/npm_global_module_list b/src/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/src/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/src/root/opt/app-root/etc/scl_enable b/src/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/src/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/src/s2i/bin/assemble b/src/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/src/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/src/s2i/bin/init-wrapper b/src/s2i/bin/init-wrapper new file mode 100644 index 00000000..24e0d078 --- /dev/null +++ b/src/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/src/s2i/bin/run b/src/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/src/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/src/s2i/bin/save-artifacts b/src/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/src/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/src/s2i/bin/usage b/src/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/src/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < Date: Thu, 23 Apr 2026 17:10:38 +0200 Subject: [PATCH 5/9] Add generetad files --- 20-minimal/Dockerfile.c10s | 68 ++++++++++ 20-minimal/Dockerfile.c9s | 68 ++++++++++ 20-minimal/Dockerfile.fedora | 74 +++++++++++ 20-minimal/Dockerfile.rhel10 | 68 ++++++++++ 20-minimal/Dockerfile.rhel8 | 68 ++++++++++ 20-minimal/Dockerfile.rhel9 | 68 ++++++++++ 20-minimal/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 20-minimal/root/opt/app-root/etc/scl_enable | 3 + 20-minimal/s2i/bin/assemble | 116 ++++++++++++++++++ 20-minimal/s2i/bin/init-wrapper | 18 +++ 20-minimal/s2i/bin/run | 83 +++++++++++++ 20-minimal/s2i/bin/save-artifacts | 5 + 20-minimal/s2i/bin/usage | 15 +++ 20-minimal/test | 1 + 20/Dockerfile.c10s | 69 +++++++++++ 20/Dockerfile.c9s | 69 +++++++++++ 20/Dockerfile.fedora | 74 +++++++++++ 20/Dockerfile.rhel10 | 69 +++++++++++ 20/Dockerfile.rhel8 | 69 +++++++++++ 20/Dockerfile.rhel9 | 69 +++++++++++ 20/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 20/root/opt/app-root/etc/scl_enable | 3 + 20/s2i/bin/assemble | 116 ++++++++++++++++++ 20/s2i/bin/init-wrapper | 18 +++ 20/s2i/bin/run | 83 +++++++++++++ 20/s2i/bin/save-artifacts | 5 + 20/s2i/bin/usage | 15 +++ 20/test | 1 + 22-minimal/Dockerfile.c10s | 68 ++++++++++ 22-minimal/Dockerfile.c9s | 68 ++++++++++ 22-minimal/Dockerfile.fedora | 74 +++++++++++ 22-minimal/Dockerfile.rhel10 | 68 ++++++++++ 22-minimal/Dockerfile.rhel8 | 68 ++++++++++ 22-minimal/Dockerfile.rhel9 | 68 ++++++++++ 22-minimal/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 22-minimal/root/opt/app-root/etc/scl_enable | 3 + 22-minimal/s2i/bin/assemble | 116 ++++++++++++++++++ 22-minimal/s2i/bin/init-wrapper | 18 +++ 22-minimal/s2i/bin/run | 83 +++++++++++++ 22-minimal/s2i/bin/save-artifacts | 5 + 22-minimal/s2i/bin/usage | 15 +++ 22-minimal/test | 1 + 22/Dockerfile.c10s | 69 +++++++++++ 22/Dockerfile.c9s | 69 +++++++++++ 22/Dockerfile.fedora | 74 +++++++++++ 22/Dockerfile.rhel10 | 69 +++++++++++ 22/Dockerfile.rhel8 | 69 +++++++++++ 22/Dockerfile.rhel9 | 69 +++++++++++ 22/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 22/root/opt/app-root/etc/scl_enable | 3 + 22/s2i/bin/assemble | 116 ++++++++++++++++++ 22/s2i/bin/init-wrapper | 18 +++ 22/s2i/bin/run | 83 +++++++++++++ 22/s2i/bin/save-artifacts | 5 + 22/s2i/bin/usage | 15 +++ 22/test | 1 + 24-minimal/Dockerfile.c10s | 68 ++++++++++ 24-minimal/Dockerfile.c9s | 68 ++++++++++ 24-minimal/Dockerfile.fedora | 74 +++++++++++ 24-minimal/Dockerfile.rhel10 | 68 ++++++++++ 24-minimal/Dockerfile.rhel8 | 68 ++++++++++ 24-minimal/Dockerfile.rhel9 | 68 ++++++++++ 24-minimal/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 24-minimal/root/opt/app-root/etc/scl_enable | 3 + 24-minimal/s2i/bin/assemble | 116 ++++++++++++++++++ 24-minimal/s2i/bin/init-wrapper | 18 +++ 24-minimal/s2i/bin/run | 83 +++++++++++++ 24-minimal/s2i/bin/save-artifacts | 5 + 24-minimal/s2i/bin/usage | 15 +++ 24-minimal/test | 1 + 24/Dockerfile.c10s | 69 +++++++++++ 24/Dockerfile.c9s | 69 +++++++++++ 24/Dockerfile.fedora | 74 +++++++++++ 24/Dockerfile.rhel10 | 69 +++++++++++ 24/Dockerfile.rhel8 | 69 +++++++++++ 24/Dockerfile.rhel9 | 69 +++++++++++ 24/README.md | 1 + .../opt/app-root/etc/generate_container_user | 17 +++ .../opt/app-root/etc/npm_global_module_list | 5 + 24/root/opt/app-root/etc/scl_enable | 3 + 24/s2i/bin/assemble | 116 ++++++++++++++++++ 24/s2i/bin/init-wrapper | 18 +++ 24/s2i/bin/run | 83 +++++++++++++ 24/s2i/bin/save-artifacts | 5 + 24/s2i/bin/usage | 15 +++ 24/test | 1 + 96 files changed, 4083 insertions(+) create mode 100644 20-minimal/Dockerfile.c10s create mode 100644 20-minimal/Dockerfile.c9s create mode 100644 20-minimal/Dockerfile.fedora create mode 100644 20-minimal/Dockerfile.rhel10 create mode 100644 20-minimal/Dockerfile.rhel8 create mode 100644 20-minimal/Dockerfile.rhel9 create mode 120000 20-minimal/README.md create mode 100644 20-minimal/root/opt/app-root/etc/generate_container_user create mode 100644 20-minimal/root/opt/app-root/etc/npm_global_module_list create mode 100644 20-minimal/root/opt/app-root/etc/scl_enable create mode 100755 20-minimal/s2i/bin/assemble create mode 100755 20-minimal/s2i/bin/init-wrapper create mode 100755 20-minimal/s2i/bin/run create mode 100755 20-minimal/s2i/bin/save-artifacts create mode 100755 20-minimal/s2i/bin/usage create mode 120000 20-minimal/test create mode 100644 20/Dockerfile.c10s create mode 100644 20/Dockerfile.c9s create mode 100644 20/Dockerfile.fedora create mode 100644 20/Dockerfile.rhel10 create mode 100644 20/Dockerfile.rhel8 create mode 100644 20/Dockerfile.rhel9 create mode 120000 20/README.md create mode 100644 20/root/opt/app-root/etc/generate_container_user create mode 100644 20/root/opt/app-root/etc/npm_global_module_list create mode 100644 20/root/opt/app-root/etc/scl_enable create mode 100755 20/s2i/bin/assemble create mode 100755 20/s2i/bin/init-wrapper create mode 100755 20/s2i/bin/run create mode 100755 20/s2i/bin/save-artifacts create mode 100755 20/s2i/bin/usage create mode 120000 20/test create mode 100644 22-minimal/Dockerfile.c10s create mode 100644 22-minimal/Dockerfile.c9s create mode 100644 22-minimal/Dockerfile.fedora create mode 100644 22-minimal/Dockerfile.rhel10 create mode 100644 22-minimal/Dockerfile.rhel8 create mode 100644 22-minimal/Dockerfile.rhel9 create mode 120000 22-minimal/README.md create mode 100644 22-minimal/root/opt/app-root/etc/generate_container_user create mode 100644 22-minimal/root/opt/app-root/etc/npm_global_module_list create mode 100644 22-minimal/root/opt/app-root/etc/scl_enable create mode 100755 22-minimal/s2i/bin/assemble create mode 100755 22-minimal/s2i/bin/init-wrapper create mode 100755 22-minimal/s2i/bin/run create mode 100755 22-minimal/s2i/bin/save-artifacts create mode 100755 22-minimal/s2i/bin/usage create mode 120000 22-minimal/test create mode 100644 22/Dockerfile.c10s create mode 100644 22/Dockerfile.c9s create mode 100644 22/Dockerfile.fedora create mode 100644 22/Dockerfile.rhel10 create mode 100644 22/Dockerfile.rhel8 create mode 100644 22/Dockerfile.rhel9 create mode 120000 22/README.md create mode 100644 22/root/opt/app-root/etc/generate_container_user create mode 100644 22/root/opt/app-root/etc/npm_global_module_list create mode 100644 22/root/opt/app-root/etc/scl_enable create mode 100755 22/s2i/bin/assemble create mode 100755 22/s2i/bin/init-wrapper create mode 100755 22/s2i/bin/run create mode 100755 22/s2i/bin/save-artifacts create mode 100755 22/s2i/bin/usage create mode 120000 22/test create mode 100644 24-minimal/Dockerfile.c10s create mode 100644 24-minimal/Dockerfile.c9s create mode 100644 24-minimal/Dockerfile.fedora create mode 100644 24-minimal/Dockerfile.rhel10 create mode 100644 24-minimal/Dockerfile.rhel8 create mode 100644 24-minimal/Dockerfile.rhel9 create mode 120000 24-minimal/README.md create mode 100644 24-minimal/root/opt/app-root/etc/generate_container_user create mode 100644 24-minimal/root/opt/app-root/etc/npm_global_module_list create mode 100644 24-minimal/root/opt/app-root/etc/scl_enable create mode 100755 24-minimal/s2i/bin/assemble create mode 100755 24-minimal/s2i/bin/init-wrapper create mode 100755 24-minimal/s2i/bin/run create mode 100755 24-minimal/s2i/bin/save-artifacts create mode 100755 24-minimal/s2i/bin/usage create mode 120000 24-minimal/test create mode 100644 24/Dockerfile.c10s create mode 100644 24/Dockerfile.c9s create mode 100644 24/Dockerfile.fedora create mode 100644 24/Dockerfile.rhel10 create mode 100644 24/Dockerfile.rhel8 create mode 100644 24/Dockerfile.rhel9 create mode 120000 24/README.md create mode 100644 24/root/opt/app-root/etc/generate_container_user create mode 100644 24/root/opt/app-root/etc/npm_global_module_list create mode 100644 24/root/opt/app-root/etc/scl_enable create mode 100755 24/s2i/bin/assemble create mode 100755 24/s2i/bin/init-wrapper create mode 100755 24/s2i/bin/run create mode 100755 24/s2i/bin/save-artifacts create mode 100755 24/s2i/bin/usage create mode 120000 24/test diff --git a/20-minimal/Dockerfile.c10s b/20-minimal/Dockerfile.c10s new file mode 100644 index 00000000..7d09c721 --- /dev/null +++ b/20-minimal/Dockerfile.c10s @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.c9s b/20-minimal/Dockerfile.c9s new file mode 100644 index 00000000..7d09c721 --- /dev/null +++ b/20-minimal/Dockerfile.c9s @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.fedora b/20-minimal/Dockerfile.fedora new file mode 100644 index 00000000..7a0faf5d --- /dev/null +++ b/20-minimal/Dockerfile.fedora @@ -0,0 +1,74 @@ +FROM :43 + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION= \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"\ + com.redhat.component="$NAME" \ + name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x /usr/libexec/s2i/init-wrapper + +# Copy extra files to the image, including help file. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.rhel10 b/20-minimal/Dockerfile.rhel10 new file mode 100644 index 00000000..7d09c721 --- /dev/null +++ b/20-minimal/Dockerfile.rhel10 @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.rhel8 b/20-minimal/Dockerfile.rhel8 new file mode 100644 index 00000000..7d09c721 --- /dev/null +++ b/20-minimal/Dockerfile.rhel8 @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.rhel9 b/20-minimal/Dockerfile.rhel9 new file mode 100644 index 00000000..7d09c721 --- /dev/null +++ b/20-minimal/Dockerfile.rhel9 @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/README.md b/20-minimal/README.md new file mode 120000 index 00000000..32d46ee8 --- /dev/null +++ b/20-minimal/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/20-minimal/root/opt/app-root/etc/generate_container_user b/20-minimal/root/opt/app-root/etc/generate_container_user new file mode 100644 index 00000000..b28a7a3d --- /dev/null +++ b/20-minimal/root/opt/app-root/etc/generate_container_user @@ -0,0 +1,17 @@ +# Set current user in nss_wrapper +USER_ID=$(id -u) +GROUP_ID=$(id -g) + +if [ x"$USER_ID" != x"0" -a x"$USER_ID" != x"1001" ]; then + + NSS_WRAPPER_PASSWD=/opt/app-root/etc/passwd + NSS_WRAPPER_GROUP=/etc/group + + cat /etc/passwd | sed -e 's/^default:/builder:/' > $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/20-minimal/root/opt/app-root/etc/npm_global_module_list b/20-minimal/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/20-minimal/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/20-minimal/root/opt/app-root/etc/scl_enable b/20-minimal/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/20-minimal/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/20-minimal/s2i/bin/assemble b/20-minimal/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/20-minimal/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/20-minimal/s2i/bin/init-wrapper b/20-minimal/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/20-minimal/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/20-minimal/s2i/bin/run b/20-minimal/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/20-minimal/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/20-minimal/s2i/bin/save-artifacts b/20-minimal/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/20-minimal/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/20-minimal/s2i/bin/usage b/20-minimal/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/20-minimal/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/20/root/opt/app-root/etc/npm_global_module_list b/20/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/20/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/20/root/opt/app-root/etc/scl_enable b/20/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/20/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/20/s2i/bin/assemble b/20/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/20/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/20/s2i/bin/init-wrapper b/20/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/20/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/20/s2i/bin/run b/20/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/20/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/20/s2i/bin/save-artifacts b/20/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/20/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/20/s2i/bin/usage b/20/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/20/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/22-minimal/root/opt/app-root/etc/npm_global_module_list b/22-minimal/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/22-minimal/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/22-minimal/root/opt/app-root/etc/scl_enable b/22-minimal/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/22-minimal/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/22-minimal/s2i/bin/assemble b/22-minimal/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/22-minimal/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/22-minimal/s2i/bin/init-wrapper b/22-minimal/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/22-minimal/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/22-minimal/s2i/bin/run b/22-minimal/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/22-minimal/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/22-minimal/s2i/bin/save-artifacts b/22-minimal/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/22-minimal/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/22-minimal/s2i/bin/usage b/22-minimal/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/22-minimal/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/22/root/opt/app-root/etc/npm_global_module_list b/22/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/22/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/22/root/opt/app-root/etc/scl_enable b/22/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/22/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/22/s2i/bin/assemble b/22/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/22/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/22/s2i/bin/init-wrapper b/22/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/22/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/22/s2i/bin/run b/22/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/22/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/22/s2i/bin/save-artifacts b/22/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/22/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/22/s2i/bin/usage b/22/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/22/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/24-minimal/root/opt/app-root/etc/npm_global_module_list b/24-minimal/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/24-minimal/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/24-minimal/root/opt/app-root/etc/scl_enable b/24-minimal/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/24-minimal/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/24-minimal/s2i/bin/assemble b/24-minimal/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/24-minimal/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/24-minimal/s2i/bin/init-wrapper b/24-minimal/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/24-minimal/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/24-minimal/s2i/bin/run b/24-minimal/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/24-minimal/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/24-minimal/s2i/bin/save-artifacts b/24-minimal/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/24-minimal/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/24-minimal/s2i/bin/usage b/24-minimal/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/24-minimal/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < $NSS_WRAPPER_PASSWD + + echo "default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin" >> $NSS_WRAPPER_PASSWD + + export NSS_WRAPPER_PASSWD + export NSS_WRAPPER_GROUP + export LD_PRELOAD=libnss_wrapper.so +fi diff --git a/24/root/opt/app-root/etc/npm_global_module_list b/24/root/opt/app-root/etc/npm_global_module_list new file mode 100644 index 00000000..005e1501 --- /dev/null +++ b/24/root/opt/app-root/etc/npm_global_module_list @@ -0,0 +1,5 @@ +async +mime +mkdirp +qs +minimatch diff --git a/24/root/opt/app-root/etc/scl_enable b/24/root/opt/app-root/etc/scl_enable new file mode 100644 index 00000000..4bfebea0 --- /dev/null +++ b/24/root/opt/app-root/etc/scl_enable @@ -0,0 +1,3 @@ +# This will make scl collection binaries work out of box. +unset BASH_ENV PROMPT_COMMAND ENV +source scl_source enable rh-nodejs${NODEJS_VERSION} diff --git a/24/s2i/bin/assemble b/24/s2i/bin/assemble new file mode 100755 index 00000000..f644a811 --- /dev/null +++ b/24/s2i/bin/assemble @@ -0,0 +1,116 @@ +#!/bin/bash + +# Prevent running assemble in builders different than official STI image. +# The official nodejs:8-onbuild already run npm install and use different +# application folder. +[ -d "/usr/src/app" ] && exit 0 + +set -e + +# FIXME: Linking of global modules is disabled for now as it causes npm failures +# under RHEL7 +# Global modules good to have +# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) +# Available global modules; only match top-level npm packages +#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) +# List all modules in common +#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') +# Link the modules +#npm link $module_list + +safeLogging () { + if [[ $1 =~ http[s]?://.*@.*$ ]]; then + echo $1 | sed 's/^.*@/redacted@/' + else + echo $1 + fi +} + +shopt -s dotglob +if [ -d /tmp/artifacts ] && [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring previous build artifacts ..." + mv -T --verbose /tmp/artifacts/node_modules "${HOME}/node_modules" +fi + +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Fix source directory permissions +fix-permissions ./ + +if [ ! -z $HTTP_PROXY ]; then + echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) + npm config set proxy $HTTP_PROXY +fi + +if [ ! -z $http_proxy ]; then + echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) + npm config set proxy $http_proxy +fi + +if [ ! -z $HTTPS_PROXY ]; then + echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) + npm config set https-proxy $HTTPS_PROXY +fi + +if [ ! -z $https_proxy ]; then + echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) + npm config set https-proxy $https_proxy +fi + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +# Set the DEV_MODE to false by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +if [ "$NODE_ENV" != "production" ]; then + + echo "---> Building your Node application from source" + npm install + +else + + echo "---> Installing all dependencies" + NODE_ENV=development npm install + + #do not fail when there is no build script + echo "---> Building in production mode" + npm run ${NPM_BUILD:-build} --if-present + + echo "---> Pruning the development dependencies" + npm prune + + NPM_TMP=$(npm config get tmp) + if ! mountpoint $NPM_TMP; then + echo "---> Cleaning the $NPM_TMP/npm-*" + rm -rf $NPM_TMP/npm-* + fi + + # Clear the npm's cache and tmp directories only if they are not a docker volumes + NPM_CACHE=$(npm config get cache) + if ! mountpoint $NPM_CACHE; then + echo "---> Cleaning the npm cache $NPM_CACHE" + #As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory + # instead of $NPM_CACHE* use $NPM_CACHE/*. + # We do not want to delete .npmrc file. + rm -rf "${NPM_CACHE:?}/" + fi +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/24/s2i/bin/init-wrapper b/24/s2i/bin/init-wrapper new file mode 100755 index 00000000..24e0d078 --- /dev/null +++ b/24/s2i/bin/init-wrapper @@ -0,0 +1,18 @@ +#!/bin/bash + +# Overview of how this script works: http://veithen.io/2014/11/16/sigterm-propagation.html +# Set a trap to kill the main app process when this +# init script receives SIGTERM or SIGINT +trap 'kill -s TERM $PID' TERM INT +# Execute the main application in the background +"$@" & +PID=$! +# wait command always terminates when trap is caught, even if the process hasn't finished yet +wait $PID +# Remove the trap and wait till the app process finishes completely +trap - TERM INT +# We wait again, since the first wait terminates when trap is caught +wait $PID +# Exit with the exit code of the app process +STATUS=$? +exit $STATUS \ No newline at end of file diff --git a/24/s2i/bin/run b/24/s2i/bin/run new file mode 100755 index 00000000..9fc5cf90 --- /dev/null +++ b/24/s2i/bin/run @@ -0,0 +1,83 @@ +#!/bin/bash + +# S2I run script for the 'nodejs' image. +# The run script executes the server that runs your application. +# +# For more information see the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Runs the nodejs application server. If the container is run in development mode, +# hot deploy and debugging are enabled. +run_node() { + echo -e "Environment: \n\tDEV_MODE=${DEV_MODE}\n\tNODE_ENV=${NODE_ENV}\n\tDEBUG_PORT=${DEBUG_PORT}" + if [ "$DEV_MODE" == true ]; then + echo "Launching via nodemon..." + exec nodemon --inspect="$DEBUG_PORT" + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $NODE_CMD + elif [ -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == false ]; then + echo "Launching via ${NODE_CMD}" + exec $NODE_CMD + elif [ ! -n "$NODE_CMD" ] && [ "$INIT_WRAPPER" == true ]; then + + package_json_start=$(sed -n 's/\s*"start"\s*:\s*"\(.*\)".*/\1/p' package.json) + package_json_main=$(sed -n 's/\s*"main"\s*:\s*"\(.*\)".*/\1/p' package.json) + + if [ -n "$package_json_start" ]; then + start_command=$package_json_start + elif [ -n $package_json_main ]; then + start_command="node ." + elif [ -f "server.js" ]; then + start_command="node server.js" + else + echo "Failed to find file for starting the Node.js application" + exit 1 + fi + echo "launching via init wrapper..." + exec ${STI_SCRIPTS_PATH}/init-wrapper $start_command + else + echo "Launching via npm..." + exec npm run -d $NPM_RUN + fi +} + +#Set the debug port to 5858 by default. +if [ -z "$DEBUG_PORT" ]; then + export DEBUG_PORT=5858 +fi + +# Set the environment to development by default. +if [ -z "$DEV_MODE" ]; then + export DEV_MODE=false +fi + +# If NODE_ENV is not set by the user, then NODE_ENV is determined by whether +# the container is run in development mode. +if [ -z "$NODE_ENV" ]; then + if [ "$DEV_MODE" == true ]; then + export NODE_ENV=development + else + export NODE_ENV=production + fi +fi + +# If the official dockerhub node image is used, skip the SCL setup below +# and just run the nodejs server +if [ -d "/usr/src/app" ]; then + run_node +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +run_node diff --git a/24/s2i/bin/save-artifacts b/24/s2i/bin/save-artifacts new file mode 100755 index 00000000..16be05e7 --- /dev/null +++ b/24/s2i/bin/save-artifacts @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ -d "${HOME}/node_modules" ] && [ "$(ls "${HOME}/node_modules" 2>/dev/null)" ]; then + tar -C "${HOME}" -cf - node_modules +fi diff --git a/24/s2i/bin/usage b/24/s2i/bin/usage new file mode 100755 index 00000000..d77326cf --- /dev/null +++ b/24/s2i/bin/usage @@ -0,0 +1,15 @@ +#!/bin/sh + +DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` + +cat < Date: Fri, 24 Apr 2026 13:14:57 +0200 Subject: [PATCH 6/9] Correct Base specs --- .../{Dockerfile.c10s => Dockerfile.c8s} | 0 20/{Dockerfile.c10s => Dockerfile.c8s} | 0 .../Dockerfile.c8s | 2 +- 20/Dockerfile.rhel10 => 22/Dockerfile.c8s | 2 +- 24-minimal/Dockerfile.c8s | 68 ++++++++++++++++++ 24/Dockerfile.c8s | 69 +++++++++++++++++++ manifest-minimal.yml | 3 + manifest.yml | 3 + specs/multispec.yml | 22 ++++-- 9 files changed, 163 insertions(+), 6 deletions(-) rename 20-minimal/{Dockerfile.c10s => Dockerfile.c8s} (100%) rename 20/{Dockerfile.c10s => Dockerfile.c8s} (100%) rename 20-minimal/Dockerfile.rhel10 => 22-minimal/Dockerfile.c8s (99%) rename 20/Dockerfile.rhel10 => 22/Dockerfile.c8s (99%) create mode 100644 24-minimal/Dockerfile.c8s create mode 100644 24/Dockerfile.c8s diff --git a/20-minimal/Dockerfile.c10s b/20-minimal/Dockerfile.c8s similarity index 100% rename from 20-minimal/Dockerfile.c10s rename to 20-minimal/Dockerfile.c8s diff --git a/20/Dockerfile.c10s b/20/Dockerfile.c8s similarity index 100% rename from 20/Dockerfile.c10s rename to 20/Dockerfile.c8s diff --git a/20-minimal/Dockerfile.rhel10 b/22-minimal/Dockerfile.c8s similarity index 99% rename from 20-minimal/Dockerfile.rhel10 rename to 22-minimal/Dockerfile.c8s index 7d09c721..09ed00cb 100644 --- a/20-minimal/Dockerfile.rhel10 +++ b/22-minimal/Dockerfile.c8s @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION=20 \ +ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ diff --git a/20/Dockerfile.rhel10 b/22/Dockerfile.c8s similarity index 99% rename from 20/Dockerfile.rhel10 rename to 22/Dockerfile.c8s index 0d2f32ae..7d8de5c7 100644 --- a/20/Dockerfile.rhel10 +++ b/22/Dockerfile.c8s @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION=20 \ +ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ diff --git a/24-minimal/Dockerfile.c8s b/24-minimal/Dockerfile.c8s new file mode 100644 index 00000000..cb29a122 --- /dev/null +++ b/24-minimal/Dockerfile.c8s @@ -0,0 +1,68 @@ +FROM :latest + +# This image provides a minimal Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ + DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices. This minimal variant excludes development tools." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME-minimal~" + + INSTALL_PKGS="" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24/Dockerfile.c8s b/24/Dockerfile.c8s new file mode 100644 index 00000000..eddeea1c --- /dev/null +++ b/24/Dockerfile.c8s @@ -0,0 +1,69 @@ +FROM :latest + +# This image provides a Node.JS environment you can use to run your Node.JS +# applications. + +EXPOSE 8080 + +# Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts +# available on the CLI without using npm's --global installation mode +# This image will be initialized with "npm run $NPM_RUN" +# See https://docs.npmjs.com/misc/scripts, and your repo's package.json +# file for possible values of NPM_RUN +# Description +# Environment: +# * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). +# Expose ports: +# * 8080 - Unprivileged port used by nodejs application + +ENV NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH +ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +Node.js is a platform built on Chrome's JavaScript runtime for easily building \ +fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ +that makes it lightweight and efficient, perfect for data-intensive real-time applications \ +that run across distributed devices." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Node.js $NODEJS_VERSION" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ + com.redhat.dev-mode="DEV_MODE:false" \ + com.redhat.deployments-dir="${APP_ROOT}/src" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ + version="$NODEJS_VERSION" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ + usage="oc new-app $FGC/$NAME~" + + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS " && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/manifest-minimal.yml b/manifest-minimal.yml index d4d53768..eeb8fbe8 100644 --- a/manifest-minimal.yml +++ b/manifest-minimal.yml @@ -13,6 +13,9 @@ DISTGEN_MULTI_RULES: - src: src/Dockerfile.minimal dest: Dockerfile.rhel10 + - src: src/Dockerfile.minimal + dest: Dockerfile.c8s + - src: src/Dockerfile.minimal dest: Dockerfile.c9s diff --git a/manifest.yml b/manifest.yml index 6b39da25..17282ed7 100644 --- a/manifest.yml +++ b/manifest.yml @@ -13,6 +13,9 @@ DISTGEN_MULTI_RULES: - src: src/Dockerfile dest: Dockerfile.rhel10 + - src: src/Dockerfile + dest: Dockerfile.c8s + - src: src/Dockerfile dest: Dockerfile.c9s diff --git a/specs/multispec.yml b/specs/multispec.yml index 994d0c07..3518b24a 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -72,6 +72,18 @@ specs: pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" check_pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + c8s: + distros: + - centos-stream-8-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c8s:c8s + org: "sclorg" + prod: "c8s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && + version: "20": version: "20" @@ -133,15 +145,15 @@ matrix: distros: - rhel-8-x86_64 - rhel-9-x86_64 - - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - - centos-stream-10-x86_64 - fedora-43-x86_64 - version: "22" distros: - rhel-8-x86_64 - rhel-9-x86_64 - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - fedora-43-x86_64 @@ -150,6 +162,7 @@ matrix: - rhel-8-x86_64 - rhel-9-x86_64 - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - fedora-43-x86_64 @@ -157,15 +170,15 @@ matrix: distros: - rhel-8-x86_64 - rhel-9-x86_64 - - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - - centos-stream-10-x86_64 - fedora-43-x86_64 - version: "22-minimal" distros: - rhel-8-x86_64 - rhel-9-x86_64 - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - fedora-43-x86_64 @@ -174,6 +187,7 @@ matrix: - rhel-8-x86_64 - rhel-9-x86_64 - rhel-10-x86_64 + - centos-stream-8-x86_64 - centos-stream-9-x86_64 - centos-stream-10-x86_64 - fedora-43-x86_64 From efa77437bb7075352c7dba5d2662565238b0de89 Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Fri, 24 Apr 2026 14:15:05 +0200 Subject: [PATCH 7/9] Correction: added empty space, Dockerfiles should reflect original versions. --- 20/Dockerfile.c8s | 24 +++-- 20/Dockerfile.c9s | 22 +++-- 20/Dockerfile.rhel8 | 22 +++-- 20/Dockerfile.rhel9 | 22 +++-- 22/Dockerfile.c10s | 20 ++-- 22/Dockerfile.c8s | 22 +++-- 22/Dockerfile.c9s | 22 +++-- 22/Dockerfile.rhel10 | 20 ++-- 22/Dockerfile.rhel8 | 22 +++-- 22/Dockerfile.rhel9 | 22 +++-- 24/Dockerfile.c10s | 20 ++-- 24/Dockerfile.c8s | 22 +++-- 24/Dockerfile.c9s | 22 +++-- 24/Dockerfile.rhel10 | 20 ++-- 24/Dockerfile.rhel8 | 22 +++-- 24/Dockerfile.rhel9 | 22 +++-- specs/multispec.yml | 13 ++- specs/multispec.yml.orig | 193 +++++++++++++++++++++++++++++++++++++++ src/Dockerfile | 33 +++---- 19 files changed, 440 insertions(+), 145 deletions(-) create mode 100644 specs/multispec.yml.orig diff --git a/20/Dockerfile.c8s b/20/Dockerfile.c8s index 0d2f32ae..1ba32c1b 100644 --- a/20/Dockerfile.c8s +++ b/20/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ @@ -66,4 +72,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.c9s b/20/Dockerfile.c9s index 0d2f32ae..a9aad951 100644 --- a/20/Dockerfile.c9s +++ b/20/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-container" \ name="sclorg/nodejs-20-c9s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/nodejs-20-c9s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:20 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/20/Dockerfile.rhel8 b/20/Dockerfile.rhel8 index 0d2f32ae..e7812d56 100644 --- a/20/Dockerfile.rhel8 +++ b/20/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-container" \ name="rhel8/nodejs-20" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel8/nodejs-20:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:20 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/20/Dockerfile.rhel9 b/20/Dockerfile.rhel9 index 0d2f32ae..aa55fed8 100644 --- a/20/Dockerfile.rhel9 +++ b/20/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-container" \ name="rhel9/nodejs-20" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel9/nodejs-20:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:20 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.c10s b/22/Dockerfile.c10s index 7d8de5c7..be5d8733 100644 --- a/22/Dockerfile.c10s +++ b/22/Dockerfile.c10s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c10s:c10s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-container" \ name="sclorg/nodejs-22-c10s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/nodejs-22-c10s:latest " MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.c8s b/22/Dockerfile.c8s index 7d8de5c7..eaef1264 100644 --- a/22/Dockerfile.c8s +++ b/22/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.c9s b/22/Dockerfile.c9s index 7d8de5c7..d81cc5a0 100644 --- a/22/Dockerfile.c9s +++ b/22/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-container" \ name="sclorg/nodejs-22-c9s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/nodejs-22-c9s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:22 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.rhel10 b/22/Dockerfile.rhel10 index 7d8de5c7..fdc88e0b 100644 --- a/22/Dockerfile.rhel10 +++ b/22/Dockerfile.rhel10 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi10/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-container" \ name="rhel10/nodejs-22" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel10/nodejs-22:latest " MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.rhel8 b/22/Dockerfile.rhel8 index 7d8de5c7..42932333 100644 --- a/22/Dockerfile.rhel8 +++ b/22/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-container" \ name="rhel8/nodejs-22" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel8/nodejs-22:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:22 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22/Dockerfile.rhel9 b/22/Dockerfile.rhel9 index 7d8de5c7..6cc726bc 100644 --- a/22/Dockerfile.rhel9 +++ b/22/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-container" \ name="rhel9/nodejs-22" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel9/nodejs-22:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:22 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.c10s b/24/Dockerfile.c10s index eddeea1c..239d2a8a 100644 --- a/24/Dockerfile.c10s +++ b/24/Dockerfile.c10s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c10s:c10s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-container" \ name="sclorg/nodejs-24-c10s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/nodejs-24-c10s:latest " MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.c8s b/24/Dockerfile.c8s index eddeea1c..41a45858 100644 --- a/24/Dockerfile.c8s +++ b/24/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.c9s b/24/Dockerfile.c9s index eddeea1c..10e5826c 100644 --- a/24/Dockerfile.c9s +++ b/24/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-container" \ name="sclorg/nodejs-24-c9s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build sclorg/nodejs-24-c9s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:24 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.rhel10 b/24/Dockerfile.rhel10 index eddeea1c..266c01a1 100644 --- a/24/Dockerfile.rhel10 +++ b/24/Dockerfile.rhel10 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi10/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-container" \ name="rhel10/nodejs-24" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel10/nodejs-24:latest " MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.rhel8 b/24/Dockerfile.rhel8 index eddeea1c..107aca61 100644 --- a/24/Dockerfile.rhel8 +++ b/24/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-container" \ name="rhel8/nodejs-24" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel8/nodejs-24:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN yum -y module enable nodejs:24 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24/Dockerfile.rhel9 b/24/Dockerfile.rhel9 index eddeea1c..f2cbd14a 100644 --- a/24/Dockerfile.rhel9 +++ b/24/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,11 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 + ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,16 +40,19 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-container" \ name="rhel9/nodejs-24" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME~" + usage="s2i build rhel9/nodejs-24:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS " && \ +RUN { yum -y module enable nodejs:24 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/specs/multispec.yml b/specs/multispec.yml index 3518b24a..1525bf44 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -75,14 +75,14 @@ specs: c8s: distros: - centos-stream-8-x86_64 - s2i_base: quay.io/sclorg/s2i-core-c8s:c8s + s2i_base: quay.io/sclorg/s2i-core-c8s org: "sclorg" prod: "c8s" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "sclorg/$NAME-$NODEJS_VERSION-c8s" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" environment_setup: >4- - { yum -y module enable nodejs:{{ spec.version }} || :; } && + yum -y module enable nodejs:$NODEJS_VERSION && \ version: "20": @@ -91,6 +91,11 @@ specs: common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" rhel_image_name: "rhel8/nodejs-{{ spec.short }}" latest_fedora: "f45" + c8s_base: "quay.io/sclorg/s2i-core-c8s" + c9s_base: "quay.io/sclorg/s2i-core-c9s:c9s" + rhel8_base: "ubi8/s2i-core:latest" + rhel9_base: "ubi9/s2i-core:latest" + fedora_base: "quay.io/fedora/s2i-core:38" "22": version: "22" diff --git a/specs/multispec.yml.orig b/specs/multispec.yml.orig new file mode 100644 index 00000000..3518b24a --- /dev/null +++ b/specs/multispec.yml.orig @@ -0,0 +1,193 @@ +version: 1 + +specs: + distroinfo: + fedora43: + distros: + - fedora-43-x86_64 + s2i_base: quay.io/fedora/s2i-core + org: "fedora" + prod: "fedora" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + latest_fedora: "43" + + rhel8: + distros: + - rhel-8-x86_64 + s2i_base: ubi8/s2i-core + org: "rhel8" + prod: "rhel8" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + yum -y module enable nodejs:{{ spec.version }} && \ + post_install: >4- + (yum -y reinstall tzdata || yum -y update tzdata ) && \ + rhel9: + distros: + - rhel-9-x86_64 + s2i_base: ubi9/s2i-core + org: "rhel9" + prod: "rhel9" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + post_install: >4- + (yum -y reinstall tzdata || yum -y update tzdata ) && \ + rhel10: + distros: + - rhel-10-x86_64 + s2i_base: ubi10/s2i-core + org: "rhel10" + prod: "rhel10" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + c9s: + distros: + - centos-stream-9-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c9s:c9s + org: "sclorg" + prod: "c9s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + + c10s: + distros: + - centos-stream-10-x86_64 + - fedora-43-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c10s:c10s + org: "sclorg" + prod: "c10s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + check_pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + + c8s: + distros: + - centos-stream-8-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c8s:c8s + org: "sclorg" + prod: "c8s" + redhat_component: "nodejs-{{ spec.short }}-container" + img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" + environment_setup: >4- + { yum -y module enable nodejs:{{ spec.version }} || :; } && + + version: + "20": + version: "20" + short: "20" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + rhel_image_name: "rhel8/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "22": + version: "22" + prev_version: "20" + short: "22" + prev_short: "20" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "24": + version: "24" + prev_version: "22" + short: "24" + prev_short: "22" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "20-minimal": + version: "20" + short: "20-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + rhel_image_name: "rhel8/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "22-minimal": + version: "22" + prev_version: "20" + short: "22-minimal" + prev_short: "20-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" + + "24-minimal": + version: "24" + prev_version: "22" + short: "24-minimal" + prev_short: "22-minimal" + common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" + rhel_image_name: "rhel9/nodejs-{{ spec.short }}" + latest_fedora: "f45" + +matrix: + include: + - version: "20" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - fedora-43-x86_64 + - version: "22" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 + - version: "24" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 + - version: "20-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - fedora-43-x86_64 + - version: "22-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 + - version: "24-minimal" + distros: + - rhel-8-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-8-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 + - fedora-43-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile index 32f86025..ba245148 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ config.s2i_base }}:latest +FROM {{ spec.s2i_base }}{% if not ":" in spec.s2i_base and spec.prod != "c8s" %}:latest{% endif %} # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,10 +20,11 @@ ENV NODEJS_VERSION={{ spec.version }} \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if config.redhat_component %} \ - CNB_STACK_ID=com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }} \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.prod != "fedora" %} \ + CNB_STACK_ID=com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }} \ CNB_USER_ID=1001 \ - CNB_GROUP_ID=0{% endif %} + CNB_GROUP_ID=0 +{% endif %} ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications" \ DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ @@ -40,24 +41,24 @@ LABEL summary="$SUMMARY" \ io.openshift.expose-services="8080:http" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i"{% if config.redhat_component %} \ - io.buildpacks.stack.id="com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }}"{% endif %} \ + io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.prod != "fedora" %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }}"{% endif %} \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if config.redhat_component %} \ - com.redhat.component="{{ config.redhat_component }}" \{% endif %} - name="{{ config.img_name }}" \ - version="{% if config.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if config.redhat_component %} \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.prod != "fedora" %} \ + com.redhat.component="{{ spec.redhat_component }}" \{% endif %} + name="{{ spec.img_name }}" \ + version="{% if spec.prod != "fedora" %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.prod != "fedora" %} \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="{% if config.redhat_component %}s2i build {{ config.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" + usage="{% if spec.prod != "fedora" %}s2i build {{ spec.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" -{% if config.environment_setup %} -RUN {{ config.environment_setup }}{% endif %} +{% if spec.environment_setup %} +RUN {{ spec.environment_setup }}{% endif %} MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS {{ config.pkgs }}" && \ -{% if config.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ +{% if spec.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ @@ -70,7 +71,7 @@ RUN {{ config.environment_setup }}{% endif %} node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} yum -y clean all --enablerepo='*'{% if config.post_install %} -RUN {{ config.post_install }}{% endif %} +RUN {{ spec.post_install }}{% endif %} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH From 7c76f458e95a0af18fdc2690821de0b93fedc742 Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Mon, 4 May 2026 14:36:40 +0200 Subject: [PATCH 8/9] Fix from creation --- 20-minimal/Dockerfile.c8s | 19 ++++++++++++------- 20-minimal/Dockerfile.c9s | 19 ++++++++++++------- 20-minimal/Dockerfile.fedora | 6 +++--- 20-minimal/Dockerfile.rhel8 | 20 +++++++++++++------- 20-minimal/Dockerfile.rhel9 | 20 +++++++++++++------- 20/Dockerfile.c8s | 2 +- 20/Dockerfile.fedora | 16 +++++++++------- 22-minimal/Dockerfile.c10s | 19 ++++++++++++------- 22-minimal/Dockerfile.c8s | 19 ++++++++++++------- 22-minimal/Dockerfile.c9s | 19 ++++++++++++------- 22-minimal/Dockerfile.fedora | 6 +++--- 22-minimal/Dockerfile.rhel10 | 19 ++++++++++++------- 22-minimal/Dockerfile.rhel8 | 20 +++++++++++++------- 22-minimal/Dockerfile.rhel9 | 20 +++++++++++++------- 22/Dockerfile.fedora | 2 +- 24-minimal/Dockerfile.c10s | 19 ++++++++++++------- 24-minimal/Dockerfile.c8s | 19 ++++++++++++------- 24-minimal/Dockerfile.c9s | 19 ++++++++++++------- 24-minimal/Dockerfile.fedora | 6 +++--- 24-minimal/Dockerfile.rhel10 | 19 ++++++++++++------- 24-minimal/Dockerfile.rhel8 | 20 +++++++++++++------- 24-minimal/Dockerfile.rhel9 | 20 +++++++++++++------- 24/Dockerfile.fedora | 16 +++++++++------- specs/multispec.yml | 6 +++++- src/Dockerfile.fedora | 16 +++++++++------- src/Dockerfile.minimal | 32 ++++++++++++++++---------------- src/Dockerfile.minimal.fedora | 6 +++--- 27 files changed, 260 insertions(+), 164 deletions(-) diff --git a/20-minimal/Dockerfile.c8s b/20-minimal/Dockerfile.c8s index 7d09c721..99a10b26 100644 --- a/20-minimal/Dockerfile.c8s +++ b/20-minimal/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/20-minimal/Dockerfile.c9s b/20-minimal/Dockerfile.c9s index 7d09c721..4561e41c 100644 --- a/20-minimal/Dockerfile.c9s +++ b/20-minimal/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-minimal-container" \ name="sclorg/nodejs-20-minimal-c9s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/nodejs-20-minimal-c9s-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:20 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/20-minimal/Dockerfile.fedora b/20-minimal/Dockerfile.fedora index 7a0faf5d..d51b43ac 100644 --- a/20-minimal/Dockerfile.fedora +++ b/20-minimal/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/fedora/fedora-minimal:38 # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION= \ +ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="-minimal" \ + name="fedora/nodejs-20-minimal-fedora-minimal" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ diff --git a/20-minimal/Dockerfile.rhel8 b/20-minimal/Dockerfile.rhel8 index 7d09c721..6a2d10a4 100644 --- a/20-minimal/Dockerfile.rhel8 +++ b/20-minimal/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-minimal-container" \ name="rhel8/nodejs-20-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel8/nodejs-20-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:20 && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/20-minimal/Dockerfile.rhel9 b/20-minimal/Dockerfile.rhel9 index 7d09c721..4041fda8 100644 --- a/20-minimal/Dockerfile.rhel9 +++ b/20-minimal/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=20 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-20 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-20-minimal-container" \ name="rhel9/nodejs-20-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel9/nodejs-20-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:20 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/20/Dockerfile.c8s b/20/Dockerfile.c8s index 1ba32c1b..0f26cc00 100644 --- a/20/Dockerfile.c8s +++ b/20/Dockerfile.c8s @@ -72,4 +72,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage +CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20/Dockerfile.fedora b/20/Dockerfile.fedora index 341d3862..63c07378 100644 --- a/20/Dockerfile.fedora +++ b/20/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/fedora/s2i-core:38 # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -42,24 +42,26 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="" \ + name="fedora/$NAME-$NODEJS_VERSION" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ usage="oc new-app $FGC/$NAME~" -RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + yum -y clean all --enablerepo='*' # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper # Copy extra files to the image, including help file. COPY ./root/ / @@ -71,4 +73,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22-minimal/Dockerfile.c10s b/22-minimal/Dockerfile.c10s index 09ed00cb..e8e3899b 100644 --- a/22-minimal/Dockerfile.c10s +++ b/22-minimal/Dockerfile.c10s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c10s:c10s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-minimal-container" \ name="sclorg/nodejs-22-minimal-c10s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/nodejs-22-minimal-c10s-minimal:latest " - INSTALL_PKGS="" && \ + INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22-minimal/Dockerfile.c8s b/22-minimal/Dockerfile.c8s index 09ed00cb..6b17357e 100644 --- a/22-minimal/Dockerfile.c8s +++ b/22-minimal/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22-minimal/Dockerfile.c9s b/22-minimal/Dockerfile.c9s index 09ed00cb..ce65a767 100644 --- a/22-minimal/Dockerfile.c9s +++ b/22-minimal/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-minimal-container" \ name="sclorg/nodejs-22-minimal-c9s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/nodejs-22-minimal-c9s-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:22 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22-minimal/Dockerfile.fedora b/22-minimal/Dockerfile.fedora index 7a0faf5d..e86a838a 100644 --- a/22-minimal/Dockerfile.fedora +++ b/22-minimal/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/sclorg/s2i-core-c10s:c10s:43 # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION= \ +ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="-minimal" \ + name="sclorg/nodejs-22-minimal-c10s-minimal" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ diff --git a/22-minimal/Dockerfile.rhel10 b/22-minimal/Dockerfile.rhel10 index 09ed00cb..17f02432 100644 --- a/22-minimal/Dockerfile.rhel10 +++ b/22-minimal/Dockerfile.rhel10 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi10/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-minimal-container" \ name="rhel10/nodejs-22-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel10/nodejs-22-minimal-minimal:latest " - INSTALL_PKGS="" && \ + INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/22-minimal/Dockerfile.rhel8 b/22-minimal/Dockerfile.rhel8 index 09ed00cb..4b9bd47d 100644 --- a/22-minimal/Dockerfile.rhel8 +++ b/22-minimal/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-minimal-container" \ name="rhel8/nodejs-22-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel8/nodejs-22-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:22 && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/22-minimal/Dockerfile.rhel9 b/22-minimal/Dockerfile.rhel9 index 09ed00cb..2fa2f9cc 100644 --- a/22-minimal/Dockerfile.rhel9 +++ b/22-minimal/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=22 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-22 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-22-minimal-container" \ name="rhel9/nodejs-22-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel9/nodejs-22-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:22 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/22/Dockerfile.fedora b/22/Dockerfile.fedora index c753aca1..7d356735 100644 --- a/22/Dockerfile.fedora +++ b/22/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/sclorg/s2i-core-c10s:c10s:43 # This image provides a Node.JS environment you can use to run your Node.JS # applications. diff --git a/24-minimal/Dockerfile.c10s b/24-minimal/Dockerfile.c10s index cb29a122..b2e846d2 100644 --- a/24-minimal/Dockerfile.c10s +++ b/24-minimal/Dockerfile.c10s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c10s:c10s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-minimal-container" \ name="sclorg/nodejs-24-minimal-c10s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/nodejs-24-minimal-c10s-minimal:latest " - INSTALL_PKGS="" && \ + INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24-minimal/Dockerfile.c8s b/24-minimal/Dockerfile.c8s index cb29a122..8bc59323 100644 --- a/24-minimal/Dockerfile.c8s +++ b/24-minimal/Dockerfile.c8s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c8s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24-minimal/Dockerfile.c9s b/24-minimal/Dockerfile.c9s index cb29a122..eff15187 100644 --- a/24-minimal/Dockerfile.c9s +++ b/24-minimal/Dockerfile.c9s @@ -1,5 +1,4 @@ -FROM :latest - +FROM quay.io/sclorg/s2i-core-c9s:c9s # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-minimal-container" \ name="sclorg/nodejs-24-minimal-c9s-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build sclorg/nodejs-24-minimal-c9s-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:24 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24-minimal/Dockerfile.fedora b/24-minimal/Dockerfile.fedora index 7a0faf5d..cf50c467 100644 --- a/24-minimal/Dockerfile.fedora +++ b/24-minimal/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/fedora/s2i-core:43 # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION= \ +ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="-minimal" \ + name="fedora/nodejs-24-minimal-fedora-minimal" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ diff --git a/24-minimal/Dockerfile.rhel10 b/24-minimal/Dockerfile.rhel10 index cb29a122..ad451cd6 100644 --- a/24-minimal/Dockerfile.rhel10 +++ b/24-minimal/Dockerfile.rhel10 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi10/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,15 +39,18 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-minimal-container" \ name="rhel10/nodejs-24-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel10/nodejs-24-minimal-minimal:latest " - INSTALL_PKGS="" && \ + INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ diff --git a/24-minimal/Dockerfile.rhel8 b/24-minimal/Dockerfile.rhel8 index cb29a122..84fa1d61 100644 --- a/24-minimal/Dockerfile.rhel8 +++ b/24-minimal/Dockerfile.rhel8 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi8/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-minimal-container" \ name="rhel8/nodejs-24-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel8/nodejs-24-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN yum -y module enable nodejs:24 && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/24-minimal/Dockerfile.rhel9 b/24-minimal/Dockerfile.rhel9 index cb29a122..696932a0 100644 --- a/24-minimal/Dockerfile.rhel9 +++ b/24-minimal/Dockerfile.rhel9 @@ -1,5 +1,4 @@ -FROM :latest - +FROM ubi9/s2i-core:latest # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +19,10 @@ ENV NODEJS_VERSION=24 \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ + CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-24 \ + CNB_USER_ID=1001 \ + CNB_GROUP_ID=0 ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ building and running various Node.js $NODEJS_VERSION applications and frameworks. \ @@ -37,20 +39,24 @@ LABEL summary="$SUMMARY" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ + io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858" name="-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="nodejs-24-minimal-container" \ name="rhel9/nodejs-24-minimal-minimal" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + usage="s2i build rhel9/nodejs-24-minimal-minimal:latest " - INSTALL_PKGS="" && \ +RUN { yum -y module enable nodejs:24 || :; } && \ INSTALL_PKGS="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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper diff --git a/24/Dockerfile.fedora b/24/Dockerfile.fedora index c0ba9732..6e25ca63 100644 --- a/24/Dockerfile.fedora +++ b/24/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM :43 +FROM quay.io/fedora/s2i-core:42 # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -42,24 +42,26 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="" \ + name="fedora/$NAME-$NODEJS_VERSION" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ usage="oc new-app $FGC/$NAME~" -RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + yum -y clean all --enablerepo='*' # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper # Copy extra files to the image, including help file. COPY ./root/ / @@ -71,4 +73,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/specs/multispec.yml b/specs/multispec.yml index 1525bf44..9b28c407 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -63,7 +63,6 @@ specs: c10s: distros: - centos-stream-10-x86_64 - - fedora-43-x86_64 s2i_base: quay.io/sclorg/s2i-core-c10s:c10s org: "sclorg" prod: "c10s" @@ -106,6 +105,7 @@ specs: c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" latest_fedora: "f45" + fedora_base: "quay.io/fedora/s2i-core:40" "24": version: "24" @@ -116,6 +116,7 @@ specs: c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" latest_fedora: "f45" + fedora_base: "quay.io/fedora/s2i-core:42" "20-minimal": version: "20" @@ -123,6 +124,7 @@ specs: common_image_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" rhel_image_name: "rhel8/nodejs-{{ spec.short }}" latest_fedora: "f45" + fedora_minimal_base: "quay.io/fedora/fedora-minimal:38" "22-minimal": version: "22" @@ -133,6 +135,7 @@ specs: c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" latest_fedora: "f45" + fedora_minimal_base: "quay.io/fedora/fedora-minimal:40" "24-minimal": version: "24" @@ -143,6 +146,7 @@ specs: c9s_image_name: "sclorg/nodejs-{{ spec.short }}-c9s" rhel_image_name: "rhel9/nodejs-{{ spec.short }}" latest_fedora: "f45" + fedora_minimal_base: "quay.io/fedora/fedora-minimal:42" matrix: include: diff --git a/src/Dockerfile.fedora b/src/Dockerfile.fedora index 3f30c3eb..19c392d1 100644 --- a/src/Dockerfile.fedora +++ b/src/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM {{ config.s2i_base }}:{{ spec.latest_fedora | default("42") }} +FROM {{ spec.fedora_base }} # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -42,24 +42,26 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="{{ config.img_name }}" \ + name="fedora/$NAME-$NODEJS_VERSION" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ usage="oc new-app $FGC/$NAME~" -RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + yum -y clean all --enablerepo='*' # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x /usr/libexec/s2i/init-wrapper +RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper # Copy extra files to the image, including help file. COPY ./root/ / @@ -71,4 +73,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/src/Dockerfile.minimal b/src/Dockerfile.minimal index 03bf0e2b..f87d3d81 100644 --- a/src/Dockerfile.minimal +++ b/src/Dockerfile.minimal @@ -1,4 +1,4 @@ -FROM {{ config.s2i_base }}:latest +FROM {{ spec.s2i_base }}{% if not ":" in spec.s2i_base and spec.prod != "c8s" %}:latest{% endif %} # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -20,8 +20,8 @@ ENV NODEJS_VERSION={{ spec.version }} \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if config.redhat_component %} \ - CNB_STACK_ID=com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }} \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.prod != "fedora" %} \ + CNB_STACK_ID=com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }} \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0{% endif %} @@ -40,23 +40,23 @@ LABEL summary="$SUMMARY" \ io.openshift.expose-services="8080:http" \ io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i"{% if config.redhat_component %} \ - io.buildpacks.stack.id="com.redhat.stacks.{{ config.org }}-nodejs-{{ spec.version }}"{% endif %} \ + io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.prod != "fedora" %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }}"{% endif %} \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if config.redhat_component %} \ - com.redhat.component="{{ config.redhat_component }}" \{% endif %} - name="{{ config.img_name }}-minimal" \ - version="{% if config.redhat_component %}1{% else %}$NODEJS_VERSION{% endif %}"{% if config.redhat_component %} \ + com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.prod != "fedora" %} \ + com.redhat.component="{{ spec.redhat_component }}" \{% endif %} + name="{{ spec.img_name }}-minimal" \ + version="{% if spec.prod != "fedora" %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.prod != "fedora" %} \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="{% if config.redhat_component %}s2i build {{ config.img_name }}-minimal:latest {% else %}oc new-app $FGC/$NAME-minimal~{% endif %}" + usage="{% if spec.prod != "fedora" %}s2i build {{ spec.img_name }}-minimal:latest {% else %}oc new-app $FGC/$NAME-minimal~{% endif %}" -{% if config.environment_setup %} -RUN {{ config.environment_setup }}{% endif %} - INSTALL_PKGS="{{ config.pkgs }}" && \ -{% if config.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +{% if spec.environment_setup %} +RUN {{ spec.environment_setup }}{% endif %} + INSTALL_PKGS="{{ spec.pkgs }}" && \ +{% if spec.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ @@ -67,9 +67,9 @@ RUN {{ config.environment_setup }}{% endif %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} - yum -y clean all --enablerepo='*'{% if config.post_install %} + yum -y clean all --enablerepo='*'{% if spec.post_install %} -RUN {{ config.post_install }}{% endif %} +RUN {{ spec.post_install }}{% endif %} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/src/Dockerfile.minimal.fedora b/src/Dockerfile.minimal.fedora index 08f5f0f8..a4bcc616 100644 --- a/src/Dockerfile.minimal.fedora +++ b/src/Dockerfile.minimal.fedora @@ -1,4 +1,4 @@ -FROM {{ config.s2i_base }}:43 +FROM {{ spec.fedora_minimal_base }} # This image provides a minimal Node.JS environment you can use to run your Node.JS # applications. @@ -16,7 +16,7 @@ EXPOSE 8080 # Expose ports: # * 8080 - Unprivileged port used by nodejs application -ENV NODEJS_VERSION={{ config.version }} \ +ENV NODEJS_VERSION={{ spec.version }} \ NPM_RUN=start \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="{{ config.img_name }}-minimal" \ + name="{{ spec.img_name }}-minimal" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ From 1e136038f0d13a7742221997cc859c4da092f1bb Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Wed, 6 May 2026 12:37:41 +0200 Subject: [PATCH 9/9] Further adjustments to src files --- 20-minimal/Dockerfile.c8s | 68 ++++++++--------- 20-minimal/Dockerfile.c9s | 70 +++++++++-------- 20-minimal/Dockerfile.fedora | 64 ++++++++-------- 20-minimal/Dockerfile.rhel8 | 70 +++++++++-------- 20-minimal/Dockerfile.rhel9 | 70 +++++++++-------- 20/Dockerfile.c8s | 17 +++-- 20/Dockerfile.c9s | 19 +++-- 20/Dockerfile.rhel8 | 21 ++++-- 20/Dockerfile.rhel9 | 22 +++--- 22-minimal/Dockerfile.c10s | 68 ++++++++--------- 22-minimal/Dockerfile.c8s | 68 ++++++++--------- 22-minimal/Dockerfile.c9s | 70 +++++++++-------- 22-minimal/Dockerfile.fedora | 65 ++++++++-------- 22-minimal/Dockerfile.rhel10 | 68 ++++++++--------- 22-minimal/Dockerfile.rhel8 | 70 +++++++++-------- 22-minimal/Dockerfile.rhel9 | 70 +++++++++-------- 22/Dockerfile.c10s | 27 ++++--- 22/Dockerfile.c8s | 19 +++-- 22/Dockerfile.c9s | 23 +++--- 22/Dockerfile.fedora | 6 +- 22/Dockerfile.rhel10 | 32 ++++---- 22/Dockerfile.rhel8 | 32 +++++--- 22/Dockerfile.rhel9 | 26 ++++--- 24-minimal/Dockerfile.c10s | 71 +++++++++--------- 24-minimal/Dockerfile.c8s | 68 ++++++++--------- 24-minimal/Dockerfile.c9s | 70 +++++++++-------- 24-minimal/Dockerfile.fedora | 65 ++++++++-------- 24-minimal/Dockerfile.rhel10 | 71 +++++++++--------- 24-minimal/Dockerfile.rhel8 | 70 +++++++++-------- 24-minimal/Dockerfile.rhel9 | 70 +++++++++-------- 24/Dockerfile.c10s | 27 ++++--- 24/Dockerfile.c8s | 19 +++-- 24/Dockerfile.c9s | 23 +++--- 24/Dockerfile.fedora | 10 +-- 24/Dockerfile.rhel10 | 32 ++++---- 24/Dockerfile.rhel8 | 32 +++++--- 24/Dockerfile.rhel9 | 26 ++++--- specs/multispec.yml | 54 +++++++------- src/Dockerfile | 135 ++++++++++++++++++++++++++++----- src/Dockerfile.fedora | 17 ++++- src/Dockerfile.minimal | 136 +++++++++++++++++++++++----------- src/Dockerfile.minimal.fedora | 66 ++++++++--------- 42 files changed, 1143 insertions(+), 984 deletions(-) diff --git a/20-minimal/Dockerfile.c8s b/20-minimal/Dockerfile.c8s index 99a10b26..d7829589 100644 --- a/20-minimal/Dockerfile.c8s +++ b/20-minimal/Dockerfile.c8s @@ -1,6 +1,4 @@ FROM quay.io/sclorg/s2i-core-c8s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.c9s b/20-minimal/Dockerfile.c9s index 4561e41c..f4e8a66c 100644 --- a/20-minimal/Dockerfile.c9s +++ b/20-minimal/Dockerfile.c9s @@ -1,6 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/centos/centos:stream9-minimal EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-minimal-container" \ name="sclorg/nodejs-20-minimal-c9s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-20-minimal-c9s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:20 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.fedora b/20-minimal/Dockerfile.fedora index d51b43ac..f6bcb7be 100644 --- a/20-minimal/Dockerfile.fedora +++ b/20-minimal/Dockerfile.fedora @@ -1,8 +1,5 @@ FROM quay.io/fedora/fedora-minimal:38 -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. - EXPOSE 8080 # Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts @@ -15,60 +12,61 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PLATFORM="fedora" \ + NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="fedora/nodejs-20-minimal-fedora-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="fedora/$NAME-$NODEJS_VERSION-minimal" \ + version="1" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which nss_wrapper-libs" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH +# +COPY ./s2i/bin/ /usr/libexec/s2i RUN chmod +x /usr/libexec/s2i/init-wrapper -# Copy extra files to the image, including help file. +# Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.rhel8 b/20-minimal/Dockerfile.rhel8 index 6a2d10a4..7722c748 100644 --- a/20-minimal/Dockerfile.rhel8 +++ b/20-minimal/Dockerfile.rhel8 @@ -1,6 +1,4 @@ -FROM ubi8/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi8/ubi-minimal:latest EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-minimal-container" \ name="rhel8/nodejs-20-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-20-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:20 && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20-minimal/Dockerfile.rhel9 b/20-minimal/Dockerfile.rhel9 index 4041fda8..8d0a45c5 100644 --- a/20-minimal/Dockerfile.rhel9 +++ b/20-minimal/Dockerfile.rhel9 @@ -1,6 +1,4 @@ -FROM ubi9/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi9/ubi-minimal EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=20 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-20 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=20 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-minimal-container" \ name="rhel9/nodejs-20-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-20-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:20 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/20/Dockerfile.c8s b/20/Dockerfile.c8s index 0f26cc00..abc9d7b9 100644 --- a/20/Dockerfile.c8s +++ b/20/Dockerfile.c8s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c8s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,27 +38,31 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.c9s b/20/Dockerfile.c9s index a9aad951..d0cba57a 100644 --- a/20/Dockerfile.c9s +++ b/20/Dockerfile.c9s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c9s:c9s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,27 +38,31 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-container" \ name="sclorg/nodejs-20-c9s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-20-c9s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " -RUN { yum -y module enable nodejs:20 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +# Package libatomic_ops was removed +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.rhel8 b/20/Dockerfile.rhel8 index e7812d56..6f620c76 100644 --- a/20/Dockerfile.rhel8 +++ b/20/Dockerfile.rhel8 @@ -1,4 +1,5 @@ FROM ubi8/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=20 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-20 \ + CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-20 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,27 +38,31 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-20" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-container" \ name="rhel8/nodejs-20" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi8/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-20:latest " + usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " -RUN yum -y module enable nodejs:20 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/20/Dockerfile.rhel9 b/20/Dockerfile.rhel9 index aa55fed8..74a5f7ee 100644 --- a/20/Dockerfile.rhel9 +++ b/20/Dockerfile.rhel9 @@ -1,4 +1,5 @@ FROM ubi9/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=20 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-20 \ + CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-20 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,27 +38,30 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-20" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-20" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-20-container" \ name="rhel9/nodejs-20" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi9/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-20:latest " + usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " -RUN { yum -y module enable nodejs:20 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper @@ -72,4 +76,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22-minimal/Dockerfile.c10s b/22-minimal/Dockerfile.c10s index e8e3899b..d041d0d5 100644 --- a/22-minimal/Dockerfile.c10s +++ b/22-minimal/Dockerfile.c10s @@ -1,6 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/centos/centos:stream10-minimal EXPOSE 8080 @@ -14,60 +12,56 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el10" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-minimal-container" \ name="sclorg/nodejs-22-minimal-c10s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c10s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-22-minimal-c10s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node-22 -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.c8s b/22-minimal/Dockerfile.c8s index 6b17357e..810774ba 100644 --- a/22-minimal/Dockerfile.c8s +++ b/22-minimal/Dockerfile.c8s @@ -1,6 +1,4 @@ FROM quay.io/sclorg/s2i-core-c8s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.c9s b/22-minimal/Dockerfile.c9s index ce65a767..8d1d2c0b 100644 --- a/22-minimal/Dockerfile.c9s +++ b/22-minimal/Dockerfile.c9s @@ -1,6 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/centos/centos:stream9-minimal EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-minimal-container" \ name="sclorg/nodejs-22-minimal-c9s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-22-minimal-c9s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:22 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.fedora b/22-minimal/Dockerfile.fedora index e86a838a..149c4955 100644 --- a/22-minimal/Dockerfile.fedora +++ b/22-minimal/Dockerfile.fedora @@ -1,7 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s:43 - -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/fedora/fedora-minimal:40 EXPOSE 8080 @@ -15,60 +12,60 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PLATFORM="fedora" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="sclorg/nodejs-22-minimal-c10s-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="fedora/$NAME-$NODEJS_VERSION-minimal" \ + version="1" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which nss_wrapper-libs" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH +# +COPY ./s2i/bin/ /usr/libexec/s2i RUN chmod +x /usr/libexec/s2i/init-wrapper -# Copy extra files to the image, including help file. +# Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.rhel10 b/22-minimal/Dockerfile.rhel10 index 17f02432..d341e59e 100644 --- a/22-minimal/Dockerfile.rhel10 +++ b/22-minimal/Dockerfile.rhel10 @@ -1,6 +1,4 @@ -FROM ubi10/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi10-minimal:latest EXPOSE 8080 @@ -14,60 +12,56 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el10" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-minimal-container" \ name="rhel10/nodejs-22-minimal-minimal" \ - version="1" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi10/$NAME-$NODEJS_VERSION-minimal" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel10/nodejs-22-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.rhel8 b/22-minimal/Dockerfile.rhel8 index 4b9bd47d..5f6d0bc3 100644 --- a/22-minimal/Dockerfile.rhel8 +++ b/22-minimal/Dockerfile.rhel8 @@ -1,6 +1,4 @@ -FROM ubi8/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi8/ubi-minimal:latest EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-minimal-container" \ name="rhel8/nodejs-22-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-22-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:22 && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22-minimal/Dockerfile.rhel9 b/22-minimal/Dockerfile.rhel9 index 2fa2f9cc..9a18e3ec 100644 --- a/22-minimal/Dockerfile.rhel9 +++ b/22-minimal/Dockerfile.rhel9 @@ -1,6 +1,4 @@ -FROM ubi9/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi9/ubi-minimal EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=22 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-22 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=22 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-minimal-container" \ name="rhel9/nodejs-22-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-22-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:22 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/22/Dockerfile.c10s b/22/Dockerfile.c10s index be5d8733..0cc8da62 100644 --- a/22/Dockerfile.c10s +++ b/22/Dockerfile.c10s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c10s:c10s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-container" \ name="sclorg/nodejs-22-c10s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c10s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-22-c10s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c10s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +# Package libatomic_ops was removed +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + rm /usr/bin/node && ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + rm /usr/bin/npm && ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + rm /usr/bin/npx && ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.c8s b/22/Dockerfile.c8s index eaef1264..1e63b3d8 100644 --- a/22/Dockerfile.c8s +++ b/22/Dockerfile.c8s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c8s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.c9s b/22/Dockerfile.c9s index d81cc5a0..0b47eefa 100644 --- a/22/Dockerfile.c9s +++ b/22/Dockerfile.c9s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c9s:c9s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-container" \ name="sclorg/nodejs-22-c9s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-22-c9s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " -RUN { yum -y module enable nodejs:22 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +# Package libatomic_ops was removed +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.fedora b/22/Dockerfile.fedora index 7d356735..49a16b05 100644 --- a/22/Dockerfile.fedora +++ b/22/Dockerfile.fedora @@ -1,4 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s:43 +FROM quay.io/fedora/s2i-core:40 # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"\ com.redhat.component="$NAME" \ - name="" \ + name="fedora/$NAME-$NODEJS_VERSION" \ version="$NODEJS_VERSION" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ @@ -71,4 +71,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel10 b/22/Dockerfile.rhel10 index fdc88e0b..e00815cc 100644 --- a/22/Dockerfile.rhel10 +++ b/22/Dockerfile.rhel10 @@ -1,4 +1,5 @@ FROM ubi10/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=22 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-22 \ + CNB_STACK_ID=com.redhat.stacks.ubi10-nodejs-22 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,33 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-22" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi10-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-container" \ name="rhel10/nodejs-22" \ - version="1" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi10/$NAME-$NODEJS_VERSION" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel10/nodejs-22:latest " + usage="s2i build ubi10/$NAME-$NODEJS_VERSION " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +# Package libatomic_ops was removed +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + rm /usr/bin/node && ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + rm /usr/bin/npm && ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + rm /usr/bin/npx && ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +76,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel8 b/22/Dockerfile.rhel8 index 42932333..99399e8f 100644 --- a/22/Dockerfile.rhel8 +++ b/22/Dockerfile.rhel8 @@ -1,4 +1,5 @@ FROM ubi8/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=22 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-22 \ + CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-22 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-22" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-container" \ name="rhel8/nodejs-22" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi8/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-22:latest " + usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " -RUN yum -y module enable nodejs:22 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-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 && \ - ln -s /usr/libexec/platform-python /usr/bin/python3 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -71,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-13/enable \ + ENV=/opt/rh/gcc-toolset-13/enable \ + PROMPT_COMMAND=". /opt/rh/gcc-toolset-13/enable" + # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/22/Dockerfile.rhel9 b/22/Dockerfile.rhel9 index 6cc726bc..6a9e0c0b 100644 --- a/22/Dockerfile.rhel9 +++ b/22/Dockerfile.rhel9 @@ -1,4 +1,5 @@ FROM ubi9/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=22 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-22 \ + CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-22 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,33 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-22" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-22" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-22-container" \ name="rhel9/nodejs-22" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi9/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-22:latest " + usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " -RUN { yum -y module enable nodejs:22 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +76,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24-minimal/Dockerfile.c10s b/24-minimal/Dockerfile.c10s index b2e846d2..dfe25b3c 100644 --- a/24-minimal/Dockerfile.c10s +++ b/24-minimal/Dockerfile.c10s @@ -1,6 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c10s:c10s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/centos/centos:stream10-minimal EXPOSE 8080 @@ -14,60 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c10s-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el10" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-minimal-container" \ name="sclorg/nodejs-24-minimal-c10s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c10s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-24-minimal-c10s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.c8s b/24-minimal/Dockerfile.c8s index 8bc59323..f0934512 100644 --- a/24-minimal/Dockerfile.c8s +++ b/24-minimal/Dockerfile.c8s @@ -1,6 +1,4 @@ FROM quay.io/sclorg/s2i-core-c8s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c8s-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c8s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.c9s b/24-minimal/Dockerfile.c9s index eff15187..5f2968c7 100644 --- a/24-minimal/Dockerfile.c9s +++ b/24-minimal/Dockerfile.c9s @@ -1,6 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/centos/centos:stream9-minimal EXPOSE 8080 @@ -14,60 +12,58 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.c9s-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-minimal-container" \ name="sclorg/nodejs-24-minimal-c9s-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-minimal-c9s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-24-minimal-c9s-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:24 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.fedora b/24-minimal/Dockerfile.fedora index cf50c467..aff5ae90 100644 --- a/24-minimal/Dockerfile.fedora +++ b/24-minimal/Dockerfile.fedora @@ -1,7 +1,4 @@ -FROM quay.io/fedora/s2i-core:43 - -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM quay.io/fedora/fedora-minimal:42 EXPOSE 8080 @@ -15,60 +12,60 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PLATFORM="fedora" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="fedora/nodejs-24-minimal-fedora-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="fedora/$NAME-$NODEJS_VERSION-minimal" \ + version="1" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH +# +COPY ./s2i/bin/ /usr/libexec/s2i RUN chmod +x /usr/libexec/s2i/init-wrapper -# Copy extra files to the image, including help file. +# Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.rhel10 b/24-minimal/Dockerfile.rhel10 index ad451cd6..242fa883 100644 --- a/24-minimal/Dockerfile.rhel10 +++ b/24-minimal/Dockerfile.rhel10 @@ -1,6 +1,4 @@ -FROM ubi10/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi10-minimal:latest EXPOSE 8080 @@ -14,60 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el10" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-minimal-container" \ name="rhel10/nodejs-24-minimal-minimal" \ - version="1" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi10/$NAME-$NODEJS_VERSION-minimal" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel10/nodejs-24-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* - INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.rhel8 b/24-minimal/Dockerfile.rhel8 index 84fa1d61..56635add 100644 --- a/24-minimal/Dockerfile.rhel8 +++ b/24-minimal/Dockerfile.rhel8 @@ -1,6 +1,4 @@ -FROM ubi8/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi8/ubi-minimal:latest EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el8" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Minimal" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-minimal-container" \ name="rhel8/nodejs-24-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi8/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-24-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN yum -y module enable nodejs:24 && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24-minimal/Dockerfile.rhel9 b/24-minimal/Dockerfile.rhel9 index 696932a0..27247979 100644 --- a/24-minimal/Dockerfile.rhel9 +++ b/24-minimal/Dockerfile.rhel9 @@ -1,6 +1,4 @@ -FROM ubi9/s2i-core:latest -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. +FROM ubi9/ubi-minimal EXPOSE 8080 @@ -14,61 +12,59 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION=24 \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-24 \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0 -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ + PLATFORM="el9" \ + NODEJS_VERSION=24 \ + NPM_RUN=start \ + NAME=nodejs + +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-minimal-container" \ name="rhel9/nodejs-24-minimal-minimal" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="ubi9/$NAME-$NODEJS_VERSION-minimal" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-24-minimal-minimal:latest " + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" + +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -RUN { yum -y module enable nodejs:24 || :; } && \ INSTALL_PKGS="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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' -RUN (yum -y reinstall tzdata || yum -y update tzdata ) && \ -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file diff --git a/24/Dockerfile.c10s b/24/Dockerfile.c10s index 239d2a8a..527c8907 100644 --- a/24/Dockerfile.c10s +++ b/24/Dockerfile.c10s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c10s:c10s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c10s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-container" \ name="sclorg/nodejs-24-c10s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c10s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-24-c10s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c10s:latest " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +# Package libatomic_ops was removed +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.c8s b/24/Dockerfile.c8s index 41a45858..59e8ccb9 100644 --- a/24/Dockerfile.c8s +++ b/24/Dockerfile.c8s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c8s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c8s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c8s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/$NAME-$NODEJS_VERSION-c8s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c8s:latest " -RUN yum -y module enable nodejs:$NODEJS_VERSION && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ 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 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.c9s b/24/Dockerfile.c9s index 10e5826c..f297ee4f 100644 --- a/24/Dockerfile.c9s +++ b/24/Dockerfile.c9s @@ -1,4 +1,5 @@ FROM quay.io/sclorg/s2i-core-c9s:c9s + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ io.buildpacks.stack.id="com.redhat.stacks.c9s-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-container" \ name="sclorg/nodejs-24-c9s" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="sclorg/$NAME-$NODEJS_VERSION-c9s" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build sclorg/nodejs-24-c9s:latest " + usage="s2i build quay.io/sclorg/$NAME-$NODEJS_VERSION-c9s:latest " -RUN { yum -y module enable nodejs:24 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +# Package libatomic_ops was removed +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +77,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.fedora b/24/Dockerfile.fedora index 6e25ca63..1880a2ed 100644 --- a/24/Dockerfile.fedora +++ b/24/Dockerfile.fedora @@ -48,20 +48,18 @@ LABEL summary="$SUMMARY" \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ usage="oc new-app $FGC/$NAME~" -RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - yum -y clean all --enablerepo='*' + dnf -y clean all --enablerepo='*' # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image, including help file. COPY ./root/ / diff --git a/24/Dockerfile.rhel10 b/24/Dockerfile.rhel10 index 266c01a1..a2954241 100644 --- a/24/Dockerfile.rhel10 +++ b/24/Dockerfile.rhel10 @@ -1,4 +1,5 @@ FROM ubi10/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=24 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel10-nodejs-24 \ + CNB_STACK_ID=com.redhat.stacks.ubi10-nodejs-24 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,33 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel10-nodejs-24" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi10-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-container" \ name="rhel10/nodejs-24" \ - version="1" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi10/$NAME-$NODEJS_VERSION" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel10/nodejs-24:latest " + usage="s2i build ubi10/$NAME-$NODEJS_VERSION " - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +# Package libatomic_ops was removed +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +76,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.rhel8 b/24/Dockerfile.rhel8 index 107aca61..4dff241e 100644 --- a/24/Dockerfile.rhel8 +++ b/24/Dockerfile.rhel8 @@ -1,4 +1,5 @@ FROM ubi8/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=24 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel8-nodejs-24 \ + CNB_STACK_ID=com.redhat.stacks.ubi8-nodejs-24 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,34 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel8-nodejs-24" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi8-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-container" \ name="rhel8/nodejs-24" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi8/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel8/nodejs-24:latest " + usage="s2i build ubi8/$NAME-$NODEJS_VERSION:latest " -RUN yum -y module enable nodejs:24 && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-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 && \ - ln -s /usr/libexec/platform-python /usr/bin/python3 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -71,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-13/enable \ + ENV=/opt/rh/gcc-toolset-13/enable \ + PROMPT_COMMAND=". /opt/rh/gcc-toolset-13/enable" + # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/24/Dockerfile.rhel9 b/24/Dockerfile.rhel9 index f2cbd14a..3982a7e5 100644 --- a/24/Dockerfile.rhel9 +++ b/24/Dockerfile.rhel9 @@ -1,4 +1,5 @@ FROM ubi9/s2i-core:latest + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -20,7 +21,7 @@ ENV NODEJS_VERSION=24 \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - CNB_STACK_ID=com.redhat.stacks.rhel9-nodejs-24 \ + CNB_STACK_ID=com.redhat.stacks.ubi9-nodejs-24 \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 @@ -37,30 +38,33 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.buildpacks.stack.id="com.redhat.stacks.rhel9-nodejs-24" \ + io.buildpacks.stack.id="com.redhat.stacks.ubi9-nodejs-24" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858" \ - com.redhat.component="nodejs-24-container" \ name="rhel9/nodejs-24" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-container" \ + name="ubi9/$NAME-$NODEJS_VERSION" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="s2i build rhel9/nodejs-24:latest " + usage="s2i build ubi9/$NAME-$NODEJS_VERSION:latest " -RUN { yum -y module enable nodejs:24 || :; } && \ MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +RUN dnf -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ 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 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' + # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / @@ -72,4 +76,4 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 # Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +CMD $STI_SCRIPTS_PATH/usage diff --git a/specs/multispec.yml b/specs/multispec.yml index 9b28c407..56df17a2 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -8,7 +8,7 @@ specs: s2i_base: quay.io/fedora/s2i-core org: "fedora" prod: "fedora" - redhat_component: "nodejs-{{ spec.short }}-container" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" latest_fedora: "43" @@ -17,57 +17,57 @@ specs: distros: - rhel-8-x86_64 s2i_base: ubi8/s2i-core - org: "rhel8" + org: "ubi8" prod: "rhel8" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "ubi8/$NAME-$NODEJS_VERSION" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - environment_setup: >4- - yum -y module enable nodejs:{{ spec.version }} && \ + environment_setup: >- + dnf -y module enable nodejs:$NODEJS_VERSION && \ post_install: >4- - (yum -y reinstall tzdata || yum -y update tzdata ) && \ + (dnf -y reinstall tzdata || dnf -y update tzdata ) && \ rhel9: distros: - rhel-9-x86_64 s2i_base: ubi9/s2i-core - org: "rhel9" + org: "ubi9" prod: "rhel9" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "ubi9/$NAME-$NODEJS_VERSION" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - environment_setup: >4- - { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + environment_setup: >- + dnf -y module enable nodejs:$NODEJS_VERSION && \ post_install: >4- - (yum -y reinstall tzdata || yum -y update tzdata ) && \ + (dnf -y reinstall tzdata || dnf -y update tzdata ) && \ rhel10: distros: - rhel-10-x86_64 s2i_base: ubi10/s2i-core - org: "rhel10" + org: "ubi10" prod: "rhel10" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "ubi10/$NAME-$NODEJS_VERSION" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" c9s: distros: - centos-stream-9-x86_64 s2i_base: quay.io/sclorg/s2i-core-c9s:c9s - org: "sclorg" + org: "c9s" prod: "c9s" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "sclorg/$NAME-$NODEJS_VERSION-c9s" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - environment_setup: >4- - { yum -y module enable nodejs:{{ spec.version }} || :; } && \ + environment_setup: >- + dnf -y module enable nodejs:$NODEJS_VERSION && \ c10s: distros: - centos-stream-10-x86_64 s2i_base: quay.io/sclorg/s2i-core-c10s:c10s - org: "sclorg" + org: "c10s" prod: "c10s" - redhat_component: "nodejs-{{ spec.short }}-container" - img_name: "{{ spec.org }}/nodejs-{{ spec.short }}-{{ spec.prod }}" + redhat_component: "${NAME}-${NODEJS_VERSION}-container" + img_name: "sclorg/$NAME-$NODEJS_VERSION-c10s" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" check_pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" @@ -75,13 +75,13 @@ specs: distros: - centos-stream-8-x86_64 s2i_base: quay.io/sclorg/s2i-core-c8s - org: "sclorg" + org: "c8s" prod: "c8s" redhat_component: "${NAME}-${NODEJS_VERSION}-container" img_name: "sclorg/$NAME-$NODEJS_VERSION-c8s" pkgs: "nodejs npm nodejs-nodemon nss_wrapper-libs which" - environment_setup: >4- - yum -y module enable nodejs:$NODEJS_VERSION && \ + environment_setup: >- + yum -y module enable nodejs:$NODEJS_VERSION && \ version: "20": diff --git a/src/Dockerfile b/src/Dockerfile index ba245148..c55c6ea0 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,5 +1,6 @@ FROM {{ spec.s2i_base }}{% if not ":" in spec.s2i_base and spec.prod != "c8s" %}:latest{% endif %} + # This image provides a Node.JS environment you can use to run your Node.JS # applications. @@ -21,7 +22,7 @@ ENV NODEJS_VERSION={{ spec.version }} \ NAME=nodejs \ NPM_CONFIG_PREFIX=$HOME/.npm-global \ PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.prod != "fedora" %} \ - CNB_STACK_ID=com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }} \ + CNB_STACK_ID=com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }} \ CNB_USER_ID=1001 \ CNB_GROUP_ID=0 {% endif %} @@ -39,45 +40,133 @@ LABEL summary="$SUMMARY" \ io.k8s.description="$DESCRIPTION" \ io.k8s.display-name="Node.js $NODEJS_VERSION" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.prod != "fedora" %} \ - io.buildpacks.stack.id="com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }}"{% endif %} \ + io.buildpacks.stack.id="com.redhat.stacks.{{ spec.org }}-nodejs-{{ spec.version }}"{% endif %} \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.prod != "fedora" %} \ - com.redhat.component="{{ spec.redhat_component }}" \{% endif %} - name="{{ spec.img_name }}" \ - version="{% if spec.prod != "fedora" %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.prod != "fedora" %} \ + com.redhat.component="{{ spec.redhat_component }}" \ +{% endif %} name="{{ spec.img_name }}" \ +{% if spec.prod == "fedora" %} version="$NODEJS_VERSION" \ +{% elif spec.prod != "rhel10" %} version="1" \ +{% endif %}{% if spec.prod != "fedora" %} com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ maintainer="SoftwareCollections.org " \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="{% if spec.prod != "fedora" %}s2i build {{ spec.img_name }}:latest {% else %}oc new-app $FGC/$NAME~{% endif %}" + usage="{% if spec.prod != "fedora" %}s2i build {% if spec.prod in ["c8s", "c9s", "c10s"] %}quay.io/{% endif %}{{ spec.img_name }}{% if spec.prod != "rhel10" %}:latest{% endif %} {% else %}oc new-app $FGC/$NAME~{% endif %}" -{% if spec.environment_setup %} -RUN {{ spec.environment_setup }}{% endif %} - MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ - INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ -{% if spec.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ +{% if spec.prod in ["c9s", "rhel10", "c10s"] %} +# Package libatomic_ops was removed +{% endif %}{% if spec.prod in ["rhel10", "c10s"] and spec.version == "22" %} +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + rm /usr/bin/node && ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + rm /usr/bin/npm && ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + rm /usr/bin/npx && ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' +{% elif spec.prod in ["rhel10", "c10s"] and spec.version == "24" %} +RUN INSTALL_PKGS="make gcc gcc-c++ git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% else %} ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' +{% elif spec.environment_setup %} +{% if spec.prod == "rhel8" and spec.version == "20" -%} +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' +{% elif spec.prod == "c8s" and spec.version == "20" -%} +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + ln -s /usr/libexec/platform-python /usr/bin/python3 && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' +{% elif spec.prod == "c9s" and spec.version == "20" -%} +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' +{% elif spec.prod == "rhel9" and spec.version == "20" -%} +RUN yum -y module enable nodejs:$NODEJS_VERSION && \ + MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' +{% elif spec.prod == "rhel8" and spec.version != "20" -%} +RUN {{ spec.environment_setup }} + MODULE_DEPS="make gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-runtime \ + libatomic_ops git openssl-devel python3.12" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' +{% elif spec.prod == "c8s" -%} +RUN {{ spec.environment_setup }} + MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ ln -s /usr/libexec/platform-python /usr/bin/python3 && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} - yum -y clean all --enablerepo='*'{% if config.post_install %} + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum -y clean all --enablerepo='*' +{% else -%} +RUN {{ spec.environment_setup }} + MODULE_DEPS="make gcc gcc-c++{% if spec.prod not in ["c9s", "rhel9"] %} libatomic_ops{% endif %} git openssl-devel" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' +{% endif -%} +{% else %} +RUN MODULE_DEPS="make {% if spec.prod == "rhel8" and spec.version != "20" %}gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-runtime \ + libatomic_ops git openssl-devel python3.12{% else %}gcc gcc-c++{% if spec.prod not in ["c9s", "rhel9"] %} libatomic_ops{% endif %} git openssl-devel{% endif %}" && \ + INSTALL_PKGS="$MODULE_DEPS {{ spec.pkgs }}" && \ + ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ +{% if spec.prod in ["c8s"] or (spec.prod == "rhel8" and spec.version == "20") %} ln -s /usr/libexec/platform-python /usr/bin/python3 && \ +{% endif %} {% if spec.prod == "c8s" or (spec.prod == "rhel8" and spec.version == "20") or (spec.prod == "c9s" and spec.version == "20") %}yum{% else %}dnf{% endif %} install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ +{% if spec.prod == "c8s" or (spec.prod == "rhel8" and spec.version == "20") or (spec.prod == "c9s" and spec.version == "20") %} yum{% else %} dnf{% endif %} -y clean all --enablerepo='*' +{% endif %}{% if config.post_install %} RUN {{ spec.post_install }}{% endif %} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +RUN chmod +x {% if spec.version == "20" %}$STI_SCRIPTS_PATH/init-wrapper + +{% else %}/usr/libexec/s2i/init-wrapper -# Copy extra files to the image. +{% endif %}# Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 @@ -86,5 +175,11 @@ RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ USER 1001 -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +{% if spec.prod == "rhel8" and spec.version != "20" %} +# Enable the SCL for all bash scripts. +ENV BASH_ENV=/opt/rh/gcc-toolset-13/enable \ + ENV=/opt/rh/gcc-toolset-13/enable \ + PROMPT_COMMAND=". /opt/rh/gcc-toolset-13/enable" + +{% endif %}# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage diff --git a/src/Dockerfile.fedora b/src/Dockerfile.fedora index 19c392d1..349e2487 100644 --- a/src/Dockerfile.fedora +++ b/src/Dockerfile.fedora @@ -48,7 +48,7 @@ LABEL summary="$SUMMARY" \ help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ usage="oc new-app $FGC/$NAME~" -RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ +{% if spec.version == "20" %}RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ INSTALL_PKGS="$MODULE_DEPS nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ @@ -58,12 +58,23 @@ RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \ ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ yum -y clean all --enablerepo='*' +{% else %}RUN INSTALL_PKGS="make gcc gcc-c++ libatomic_ops git openssl-devel nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf -y clean all --enablerepo='*' +{% endif %} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +{% if spec.version == "20" %}RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper + +{% else %}RUN chmod +x /usr/libexec/s2i/init-wrapper -# Copy extra files to the image, including help file. +{% endif %}# Copy extra files to the image, including help file. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 diff --git a/src/Dockerfile.minimal b/src/Dockerfile.minimal index f87d3d81..1ebdde0e 100644 --- a/src/Dockerfile.minimal +++ b/src/Dockerfile.minimal @@ -1,7 +1,5 @@ -FROM {{ spec.s2i_base }}{% if not ":" in spec.s2i_base and spec.prod != "c8s" %}:latest{% endif %} +{% if spec.prod == "rhel8" %}FROM ubi8/ubi-minimal:latest{% elif spec.prod == "rhel9" %}FROM ubi9/ubi-minimal{% elif spec.prod == "rhel10" %}FROM ubi10-minimal:latest{% elif spec.prod == "c8s" %}FROM quay.io/sclorg/s2i-core-c8s{% elif spec.prod == "c9s" %}FROM quay.io/centos/centos:stream9-minimal{% elif spec.prod == "c10s" %}FROM quay.io/centos/centos:stream10-minimal{% elif spec.prod == "fedora" %}FROM {{ spec.fedora_minimal_base }}{% endif %} -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. EXPOSE 8080 @@ -15,74 +13,122 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION={{ spec.version }} \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH{% if spec.prod != "fedora" %} \ - CNB_STACK_ID=com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }} \ - CNB_USER_ID=1001 \ - CNB_GROUP_ID=0{% endif %} +{% if spec.prod in ["rhel8", "c8s"] %} PLATFORM="el8" \ +{% elif spec.prod in ["rhel9", "c9s"] %} PLATFORM="el9" \ +{% elif spec.prod in ["rhel10", "c10s"] %} PLATFORM="el10" \ +{% elif spec.prod == "fedora" %} PLATFORM="fedora" \ +{% endif %} NODEJS_VERSION={{ spec.version }} \ + NPM_RUN=start \ + NAME=nodejs -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION {% if spec.prod in ["rhel9", "rhel10", "c9s", "c10s"] %}Micro{% else %}Minimal{% endif %}" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ - io.s2i.scripts-url="image:///usr/libexec/s2i"{% if spec.prod != "fedora" %} \ - io.buildpacks.stack.id="com.redhat.stacks.{{ spec.prod }}-nodejs-{{ spec.version }}"{% endif %} \ + io.s2i.scripts-url="image:///usr/libexec/s2i" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ com.redhat.dev-mode.port="DEBUG_PORT:5858"{% if spec.prod != "fedora" %} \ - com.redhat.component="{{ spec.redhat_component }}" \{% endif %} - name="{{ spec.img_name }}-minimal" \ - version="{% if spec.prod != "fedora" %}1{% else %}$NODEJS_VERSION{% endif %}"{% if spec.prod != "fedora" %} \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ +{% endif %} name="{% if spec.prod in ["c8s", "c9s", "c10s"] %}sclorg/$NAME-$NODEJS_VERSION-minimal-{{ spec.prod }}{% else %}{{ spec.img_name }}-minimal{% endif %}"{% if spec.prod != "rhel10" %} \ + version="{% if spec.prod == "fedora" %}$NODEJS_VERSION{% else %}1{% endif %}"{% endif %}{% if spec.prod in ["rhel8", "rhel9", "rhel10"] %} \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"{% endif %} \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="{% if spec.prod != "fedora" %}s2i build {{ spec.img_name }}-minimal:latest {% else %}oc new-app $FGC/$NAME-minimal~{% endif %}" + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" -{% if spec.environment_setup %} -RUN {{ spec.environment_setup }}{% endif %} - INSTALL_PKGS="{{ spec.pkgs }}" && \ -{% if spec.prod == "fedora" %} yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ +{% if spec.prod == "fedora" %}# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-npm findutils tar which" && \ + dnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% else %} ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \ - ln -s /usr/libexec/platform-python /usr/bin/python3 && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \{% endif %} - yum -y clean all --enablerepo='*'{% if spec.post_install %} - -RUN {{ spec.post_install }}{% endif %} + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + dnf clean all +{% elif spec.prod == "c8s" %}# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% elif spec.prod == "c9s" and spec.version == "22" %}# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + yum -y module disable nodejs && \ + yum -y module enable nodejs:$NODEJS_VERSION && \ + yum -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + yum clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% elif spec.prod == "rhel10" %}# nodejs-full-i18n is included for error strings +{% if spec.version == "22" %}RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% else %}RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% endif %} +{% elif spec.prod == "c10s" %}# nodejs-full-i18n is included for error strings +{% if spec.version == "22" %}RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node-22 -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% else %}RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ + ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ + ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ + ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% endif %} +{% else %}# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \ + microdnf -y module disable nodejs && \ + microdnf -y module enable nodejs:$NODEJS_VERSION && \ + microdnf {% if spec.prod != "rhel8" %}-y {% endif %}--nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + microdnf clean all && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* +{% endif %} -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -RUN chmod +x $STI_SCRIPTS_PATH/init-wrapper +COPY ./s2i/bin/ /usr/libexec/s2i +RUN chmod +x /usr/libexec/s2i/init-wrapper # Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ +{% if spec.prod in ["rhel8", "rhel9", "rhel10", "c8s", "c9s", "c10s"] %}RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" +USER 1001 +{% else %}RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ rpm-file-permissions USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file +{% endif %} diff --git a/src/Dockerfile.minimal.fedora b/src/Dockerfile.minimal.fedora index a4bcc616..65393e36 100644 --- a/src/Dockerfile.minimal.fedora +++ b/src/Dockerfile.minimal.fedora @@ -1,8 +1,5 @@ FROM {{ spec.fedora_minimal_base }} -# This image provides a minimal Node.JS environment you can use to run your Node.JS -# applications. - EXPOSE 8080 # Add $HOME/node_modules/.bin to the $PATH, allowing user to make npm scripts @@ -15,60 +12,61 @@ EXPOSE 8080 # * $NPM_RUN - Select an alternate / custom runtime mode, defined in your package.json files' scripts section (default: npm run "start"). # Expose ports: # * 8080 - Unprivileged port used by nodejs application - -ENV NODEJS_VERSION={{ spec.version }} \ +ENV APP_ROOT=/opt/app-root \ + # The $HOME is not set by default, but some applications need this variable + HOME=/opt/app-root/src \ NPM_RUN=start \ - NAME=nodejs \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH + PLATFORM="fedora" \ + NODEJS_VERSION={{ spec.version }} \ + NPM_RUN=start \ + NAME=nodejs -ENV SUMMARY="Platform for building and running Node.js $NODEJS_VERSION applications (minimal)" \ - DESCRIPTION="Node.js $NODEJS_VERSION minimal available as container is a base platform for \ -building and running various Node.js $NODEJS_VERSION applications and frameworks. \ +ENV SUMMARY="Minimal image for running Node.js $NODEJS_VERSION applications" \ + DESCRIPTION="Node.js $NODEJS_VERSION available as container is a base platform for \ +running various Node.js $NODEJS_VERSION applications and frameworks. \ Node.js is a platform built on Chrome's JavaScript runtime for easily building \ fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model \ that makes it lightweight and efficient, perfect for data-intensive real-time applications \ -that run across distributed devices. This minimal variant excludes development tools." +that run across distributed devices." \ + NPM_CONFIG_PREFIX=$HOME/.npm-global \ + PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Node.js $NODEJS_VERSION (minimal)" \ + io.k8s.display-name="Node.js $NODEJS_VERSION Micro" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,$NAME,$NAME$NODEJS_VERSION,minimal" \ + io.openshift.tags="builder,$NAME,${NAME}${NODEJS_VERSION}" \ io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \ io.s2i.scripts-url="image:///usr/libexec/s2i" \ com.redhat.dev-mode="DEV_MODE:false" \ com.redhat.deployments-dir="${APP_ROOT}/src" \ - com.redhat.dev-mode.port="DEBUG_PORT:5858"\ - com.redhat.component="$NAME" \ - name="{{ spec.img_name }}-minimal" \ - version="$NODEJS_VERSION" \ + com.redhat.dev-mode.port="DEBUG_PORT:5858" \ + com.redhat.component="${NAME}-${NODEJS_VERSION}-minimal-container" \ + name="fedora/$NAME-$NODEJS_VERSION-minimal" \ + version="1" \ maintainer="SoftwareCollections.org " \ - help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \ - usage="oc new-app $FGC/$NAME-minimal~" + help="For more information visit https://github.com/sclorg/s2i-nodejs-container" -RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs$NODEJS_VERSION-npm nss_wrapper-libs which" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ +# nodejs-full-i18n is included for error strings +RUN INSTALL_PKGS="nodejs$NODEJS_VERSION nodejs-nodemon nodejs$NODEJS_VERSION-full-i18n nodejs$NODEJS_VERSION-npm findutils tar which{% if spec.version != "24" %} nss_wrapper-libs{% endif %}" && \ + microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \ + microdnf clean all && \ ln -s /usr/bin/node-$NODEJS_VERSION /usr/bin/node && \ ln -s /usr/bin/npm-$NODEJS_VERSION /usr/bin/npm && \ ln -s /usr/bin/npx-$NODEJS_VERSION /usr/bin/npx && \ - node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ - dnf -y clean all --enablerepo='*' +{% if spec.version == "20" %} ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_$NODEJS_VERSION/nodemon && \ +{% endif %} node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \ + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH +# +COPY ./s2i/bin/ /usr/libexec/s2i RUN chmod +x /usr/libexec/s2i/init-wrapper -# Copy extra files to the image, including help file. +# Copy extra files to the image. COPY ./root/ / # Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - +RUN mkdir -p "$HOME" && chown -R 1001:0 "$APP_ROOT" && chmod -R ug+rwx "$APP_ROOT" +WORKDIR "$HOME" USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage \ No newline at end of file