diff --git a/14-minimal/.exclude-rhel8 b/14-minimal/.exclude-rhel8 deleted file mode 100644 index e69de29b..00000000 diff --git a/14-minimal/.exclude.c9s b/14-minimal/.exclude.c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/14-minimal/Dockerfile.rhel8 b/14-minimal/Dockerfile.rhel8 deleted file mode 100644 index b75686e9..00000000 --- a/14-minimal/Dockerfile.rhel8 +++ /dev/null @@ -1,69 +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=14 \ - 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" - -RUN INSTALL_PKGS="nodejs nodejs-nodemon npm findutils tar" && \ - microdnf module disable nodejs && \ - microdnf module enable nodejs:$NODEJS_VERSION && \ - microdnf --nodocs 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/14-minimal/README.md b/14-minimal/README.md deleted file mode 100644 index b7154d6a..00000000 --- a/14-minimal/README.md +++ /dev/null @@ -1,4 +0,0 @@ -NodeJS 14 minimal container image -========================= - -**The NodeJS 14 minimal image is deprecated.** diff --git a/14-minimal/root/usr/bin/fix-permissions b/14-minimal/root/usr/bin/fix-permissions deleted file mode 100755 index ddd33ace..00000000 --- a/14-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/14-minimal/s2i/bin/assemble b/14-minimal/s2i/bin/assemble deleted file mode 100755 index f644a811..00000000 --- a/14-minimal/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/14-minimal/s2i/bin/init-wrapper b/14-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/14-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/14-minimal/s2i/bin/run b/14-minimal/s2i/bin/run deleted file mode 100755 index 45d23d69..00000000 --- a/14-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/14-minimal/s2i/bin/save-artifacts b/14-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/14-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/14-minimal/s2i/bin/usage b/14-minimal/s2i/bin/usage deleted file mode 100755 index f647c6f3..00000000 --- a/14-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/14/root/opt/app-root/etc/npm_global_module_list b/14/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/14/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/14/root/opt/app-root/etc/scl_enable b/14/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/14/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/14/s2i/bin/assemble b/14/s2i/bin/assemble deleted file mode 100755 index f644a811..00000000 --- a/14/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/14/s2i/bin/init-wrapper b/14/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/14/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/14/s2i/bin/run b/14/s2i/bin/run deleted file mode 100755 index 9fc5cf90..00000000 --- a/14/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/14/s2i/bin/save-artifacts b/14/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/14/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/14/s2i/bin/usage b/14/s2i/bin/usage deleted file mode 100755 index ed5a2d9c..00000000 --- a/14/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat <&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/16-minimal/s2i/bin/assemble b/16-minimal/s2i/bin/assemble deleted file mode 100755 index a5767210..00000000 --- a/16-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/16-minimal/s2i/bin/init-wrapper b/16-minimal/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/16-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/16-minimal/s2i/bin/run b/16-minimal/s2i/bin/run deleted file mode 100755 index 45d23d69..00000000 --- a/16-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/16-minimal/s2i/bin/save-artifacts b/16-minimal/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/16-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/16-minimal/s2i/bin/usage b/16-minimal/s2i/bin/usage deleted file mode 100755 index 4c8da5a1..00000000 --- a/16-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/16/root/opt/app-root/etc/npm_global_module_list b/16/root/opt/app-root/etc/npm_global_module_list deleted file mode 100644 index 005e1501..00000000 --- a/16/root/opt/app-root/etc/npm_global_module_list +++ /dev/null @@ -1,5 +0,0 @@ -async -mime -mkdirp -qs -minimatch diff --git a/16/root/opt/app-root/etc/scl_enable b/16/root/opt/app-root/etc/scl_enable deleted file mode 100644 index 4bfebea0..00000000 --- a/16/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/16/s2i/bin/assemble b/16/s2i/bin/assemble deleted file mode 100755 index f644a811..00000000 --- a/16/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/16/s2i/bin/init-wrapper b/16/s2i/bin/init-wrapper deleted file mode 100644 index 24e0d078..00000000 --- a/16/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/16/s2i/bin/run b/16/s2i/bin/run deleted file mode 100755 index 9fc5cf90..00000000 --- a/16/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/16/s2i/bin/save-artifacts b/16/s2i/bin/save-artifacts deleted file mode 100755 index 16be05e7..00000000 --- a/16/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/16/s2i/bin/usage b/16/s2i/bin/usage deleted file mode 100755 index 775106c5..00000000 --- a/16/s2i/bin/usage +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` - -cat <