Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node.js 20 #400

Merged
merged 28 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7a8e784
[1/3] Add Node.js 20: (move 18->20) to keep history
hhorak Aug 11, 2023
e64410b
[2/3] Add Node.js 20 (copy 20->18)
hhorak Aug 11, 2023
333745c
[3/3] Add Node.js 20 (patch s/18/20)
hhorak Aug 11, 2023
bcebca6
Use nss_wrapper-libs in rhel and centos as well
hhorak Aug 21, 2023
82acbf8
Add pretty small package which to have which cmd
hhorak Aug 21, 2023
adec005
Add devel repo file to be able to install RPMs from devel source
hhorak Aug 21, 2023
006aa46
Add v20 to the root README.md
hhorak Aug 21, 2023
0a41328
Add v20 to build-push action config
hhorak Aug 21, 2023
07f89a2
Add CentOS Stream composes to have the newly built Node.js 20
hhorak Aug 21, 2023
14ed37f
Remove duplicit which package
hhorak Aug 21, 2023
508d151
Add v20 to Makefile
hhorak Aug 21, 2023
67da291
Some upstream tests fail with the newest version, let's mark them uns…
hhorak Aug 22, 2023
8410055
Revert a wrong s/18/20/ replacement in the i18n package name
hhorak Aug 22, 2023
30e5da8
Be explicit about where to get ubi8/ image
hhorak Aug 23, 2023
3a5db59
Remove duplicate line in 18-minimal/Dockerfile.fedora
hhorak Aug 23, 2023
339458e
Use updated common that allows to build/tag non-minimal version as well
hhorak Aug 23, 2023
6ce177b
Be more clever about guessing FULL_IMAGE name
hhorak Aug 23, 2023
897398d
Add fixed minimal variants for Fedora
hhorak Aug 23, 2023
4300b13
Fix Fedora dockerfiles to build fine
hhorak Aug 23, 2023
08a6961
Fix CentOS Stream builds
hhorak Aug 28, 2023
34919ee
Fix Fedora dockerfiles and update to F38
hhorak Aug 28, 2023
1f48765
Sync assemble of 20 with 20-minimal
hhorak Aug 28, 2023
ef0743e
Mark the failing clients tests unstable and ignore their result
hhorak Aug 28, 2023
64a310c
Mark faas client test unstable on v14
hhorak Aug 30, 2023
edcd6e9
Remove devel files, they are added automatically now
hhorak Sep 5, 2023
67f394a
Add pretty small package which to have which cmd
hhorak Sep 5, 2023
4989bbb
Revert "Remove devel files, they are added automatically now"
hhorak Sep 6, 2023
754228a
Remove temporary copr repos, correct nodemon is already available off…
hhorak Sep 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ jobs:
quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME"
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"
image_name: "nodejs-18"
- dockerfile: "20/Dockerfile.fedora"
docker_context: 20
registry_namespace: "fedora"
tag: "fedora"
quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME"
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"
image_name: "nodejs-20"
steps:
- name: Build and push to quay.io registry
uses: sclorg/build-and-push-action@v4
Expand Down
2 changes: 1 addition & 1 deletion 16-minimal/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LABEL summary="$SUMMARY" \
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" && \
RUN INSTALL_PKGS="nodejs nodejs-nodemon nodejs-full-i18n npm findutils tar which" && \
microdnf module disable nodejs && \
microdnf module enable nodejs:$NODEJS_VERSION && \
microdnf --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \
Expand Down
2 changes: 1 addition & 1 deletion 16-minimal/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LABEL summary="$SUMMARY" \
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" && \
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 && \
Expand Down
15 changes: 10 additions & 5 deletions 16/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedora/s2i-core:35
FROM quay.io/fedora/s2i-core:38

# This image provides a Node.JS environment you can use to run your Node.JS
# applications.
Expand Down Expand Up @@ -42,17 +42,22 @@ LABEL summary="$SUMMARY" \
com.redhat.deployments-dir="${APP_ROOT}/src" \
com.redhat.dev-mode.port="DEBUG_PORT:5858"\
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="fedora/$NAME-$NODEJS_VERSION" \
version="$NODEJS_VERSION" \
maintainer="SoftwareCollections.org <[email protected]>" \
help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \
usage="oc new-app $FGC/$NAME~<SOURCE-REPOSITORY>"

RUN yum -y module enable nodejs:$NODEJS_VERSION && \
MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \
INSTALL_PKGS="$MODULE_DEPS nodejs nodejs-nodemon npm nss_wrapper which" && \
ADD https://copr.fedorainfracloud.org/coprs/hhorak/nodemon-for-all/repo/fedora-38/hhorak-nodemon-for-all-fedora-38.repo /etc/yum.repos.d/hhorak-nodemon-for-all-fedora-38.repo

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='*'

Expand Down
2 changes: 1 addition & 1 deletion 16/Dockerfile.rhel7
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ LABEL summary="$SUMMARY" \
RUN yum install -y yum-utils && \
prepare-yum-repositories rhel-server-rhscl-7-rpms && \
MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \
INSTALL_PKGS="$MODULE_DEPS rh-nodejs${NODEJS_VERSION} rh-nodejs${NODEJS_VERSION}-npm rh-nodejs${NODEJS_VERSION}-nodejs-nodemon nss_wrapper" && \
INSTALL_PKGS="$MODULE_DEPS rh-nodejs${NODEJS_VERSION} rh-nodejs${NODEJS_VERSION}-npm rh-nodejs${NODEJS_VERSION}-nodejs-nodemon nss_wrapper 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 && \
Expand Down
2 changes: 1 addition & 1 deletion 16/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LABEL summary="$SUMMARY" \

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" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
2 changes: 1 addition & 1 deletion 16/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LABEL summary="$SUMMARY" \
usage="s2i build <SOURCE-REPOSITORY> ubi9/$NAME-$NODEJS_VERSION:latest <APP-NAME>"

RUN MODULE_DEPS="make gcc gcc-c++ git openssl-devel" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
5 changes: 2 additions & 3 deletions 18-minimal/Dockerfile.c8s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubi8/ubi-minimal:latest
FROM quay.io/sclorg/s2i-core-c8s
phracek marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 8080

Expand Down Expand Up @@ -45,12 +45,11 @@ LABEL summary="$SUMMARY" \
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" \
phracek marked this conversation as resolved.
Show resolved Hide resolved
maintainer="SoftwareCollections.org <[email protected]>" \
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" && \
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 && \
Expand Down
7 changes: 3 additions & 4 deletions 18-minimal/Dockerfile.c9s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubi9/ubi-minimal
FROM quay.io/sclorg/s2i-core-c9s
phracek marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 8080

Expand Down Expand Up @@ -43,14 +43,13 @@ LABEL summary="$SUMMARY" \
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" \
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 <[email protected]>" \
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" && \
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 && \
Expand Down
66 changes: 66 additions & 0 deletions 18-minimal/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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 <[email protected]>" \
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

# 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
2 changes: 1 addition & 1 deletion 18-minimal/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LABEL summary="$SUMMARY" \
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" && \
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 && \
Expand Down
2 changes: 1 addition & 1 deletion 18-minimal/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LABEL summary="$SUMMARY" \
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" && \
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 && \
Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LABEL summary="$SUMMARY" \

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" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LABEL summary="$SUMMARY" \
# 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" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
7 changes: 3 additions & 4 deletions 18/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedora/s2i-core:36
FROM quay.io/fedora/s2i-core:38

# This image provides a Node.JS environment you can use to run your Node.JS
# applications.
Expand Down Expand Up @@ -48,9 +48,8 @@ LABEL summary="$SUMMARY" \
help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \
usage="oc new-app $FGC/$NAME~<SOURCE-REPOSITORY>"

RUN yum -y module enable nodejs:$NODEJS_VERSION && \
MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \
INSTALL_PKGS="$MODULE_DEPS nodejs nodejs-nodemon npm nss_wrapper-libs which" && \
RUN MODULE_DEPS="make gcc gcc-c++ libatomic_ops git openssl-devel" && \
INSTALL_PKGS="$MODULE_DEPS nodejs nodejs-nodemon nodejs-npm nss_wrapper-libs which" && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" && \
Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LABEL summary="$SUMMARY" \

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" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LABEL summary="$SUMMARY" \

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" && \
INSTALL_PKGS="$MODULE_DEPS nodejs npm nodejs-nodemon nss_wrapper 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 && \
Expand Down
Empty file added 20-minimal/.devel-repo-rhel8
Empty file.
Empty file added 20-minimal/.devel-repo-rhel9
Empty file.
68 changes: 68 additions & 0 deletions 20-minimal/Dockerfile.c8s
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM quay.io/sclorg/s2i-core-c8s
phracek marked this conversation as resolved.
Show resolved Hide resolved

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 <[email protected]>" \
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

# 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
Loading