From a5e3022734ad7b5c8420f50fbc5409c1a3a2fe44 Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Fri, 31 Jul 2020 08:22:08 -0400 Subject: [PATCH 1/5] troubleshooting build errors --- Dockerfile | 6 +----- private/scripts/clean-final.sh | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index cdd2839e..8a8d0a8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,12 +16,8 @@ RUN apk update \ && apk add ${BUILD_PACKAGES} \ && mkdir -p /root \ && mkdir -p /app \ - && npm config set unsafe-perm true \ - && npm install -g npm@4 \ - && npm install -g node-gyp@latest \ - && node-gyp install \ + && npm config set unsafe-perm true \ && $METEORD_DIR/build_app.sh \ - && $METEORD_DIR/rebuild_npm_modules.sh \ && apk del --purge ${BUILD_PACKAGES} \ && $METEORD_DIR/clean-final.sh diff --git a/private/scripts/clean-final.sh b/private/scripts/clean-final.sh index 3b4cbe5b..5ffd9ccd 100755 --- a/private/scripts/clean-final.sh +++ b/private/scripts/clean-final.sh @@ -19,7 +19,7 @@ set -e npm uninstall -g node-gyp -npm cache clear +npm cache clear --force rm -rf $METEORD_DIR/bin /usr/share/doc /usr/share/man /tmp/* /var/cache/apk/* \ /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp #/usr/lib/node_modules/npm From a708d73f0cb22723361ba53864d79a507b841def Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Fri, 31 Jul 2020 08:34:09 -0400 Subject: [PATCH 2/5] cache clear testing --- private/scripts/clean-final.sh | 3 +- private/scripts/rebuild_npm_modules.sh | 89 -------------------------- 2 files changed, 1 insertion(+), 91 deletions(-) delete mode 100755 private/scripts/rebuild_npm_modules.sh diff --git a/private/scripts/clean-final.sh b/private/scripts/clean-final.sh index 5ffd9ccd..7604b912 100755 --- a/private/scripts/clean-final.sh +++ b/private/scripts/clean-final.sh @@ -18,8 +18,7 @@ set -e -npm uninstall -g node-gyp -npm cache clear --force +npm cache clear rm -rf $METEORD_DIR/bin /usr/share/doc /usr/share/man /tmp/* /var/cache/apk/* \ /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp #/usr/lib/node_modules/npm diff --git a/private/scripts/rebuild_npm_modules.sh b/private/scripts/rebuild_npm_modules.sh deleted file mode 100755 index ce0349a9..00000000 --- a/private/scripts/rebuild_npm_modules.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -### -# Copyright 2019 IBM Corp. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -## - -set -e - -export PYTHONPATH=/usr/lib/python2.7 -export GYP_DEFINES="linux_use_gold_flags=0" - -gyp_rebuild_inside_node_modules () { - for npmModule in ./*; do - cd $npmModule - - isBinaryModule="no" - # recursively rebuild npm modules inside node_modules - check_for_binary_modules () { - if [ -f binding.gyp ]; then - isBinaryModule="yes" - fi - - if [ $isBinaryModule != "yes" ]; then - if [ -d ./node_modules ]; then - cd ./node_modules - for module in ./*; do - cd $module - check_for_binary_modules - cd .. - done - cd ../ - fi - fi - } - - check_for_binary_modules - - if [ $isBinaryModule == "yes" ]; then - echo " > $npmModule: npm install due to binary npm modules" - rm -rf node_modules - if [ -f binding.gyp ]; then - npm install - node-gyp rebuild || : - else - npm install - fi - fi - - cd .. - done -} - -rebuild_binary_npm_modules () { - for package in ./*; do - if [ -d $package/node_modules ]; then - cd $package/node_modules - gyp_rebuild_inside_node_modules - cd ../../ - elif [ -d $package/main/node_module ]; then - cd $package/node_modules - gyp_rebuild_inside_node_modules - cd ../../../ - fi - done -} - -if [ -d ./npm ]; then - cd npm - rebuild_binary_npm_modules - cd ../ -fi - -if [ -d ./node_modules ]; then - cd ./node_modules - gyp_rebuild_inside_node_modules - cd ../ -fi From 6293e2a24d5334d297cc5bc0e1f892075ce7e7fc Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Fri, 31 Jul 2020 08:43:06 -0400 Subject: [PATCH 3/5] cleanup --- private/scripts/build_app.sh | 26 ++++---------------------- private/scripts/clean-final.sh | 2 +- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/private/scripts/build_app.sh b/private/scripts/build_app.sh index 1fe7217f..68d4c85f 100755 --- a/private/scripts/build_app.sh +++ b/private/scripts/build_app.sh @@ -18,25 +18,7 @@ set -e -if [ -d /bundle ]; then - cd /bundle - tar xzf *.tar.gz - cd /bundle/bundle/programs/server/ - npm install - cd /bundle/bundle/ -elif [[ $BUNDLE_URL ]]; then - cd /tmp - curl -L -o bundle.tar.gz $BUNDLE_URL - tar xzf bundle.tar.gz - cd /tmp/bundle/programs/server/ - npm install - cd /tmp/bundle/ -elif [ -d /app ]; then - cd /app - cd /app/programs/server/ - npm install - cd /app -else - echo "=> You don't have an meteor app to run in this image." - exit 1 -fi +cd /app +cd /app/programs/server/ +npm install +cd /app \ No newline at end of file diff --git a/private/scripts/clean-final.sh b/private/scripts/clean-final.sh index 7604b912..523f7b11 100755 --- a/private/scripts/clean-final.sh +++ b/private/scripts/clean-final.sh @@ -18,7 +18,7 @@ set -e -npm cache clear +npm cache clear --force rm -rf $METEORD_DIR/bin /usr/share/doc /usr/share/man /tmp/* /var/cache/apk/* \ /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp #/usr/lib/node_modules/npm From 9ff118bc18e242543fe49c30b9ef91795d5d7ac2 Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Fri, 31 Jul 2020 09:18:37 -0400 Subject: [PATCH 4/5] force elliptic 6.5.3 due to security vulnerability --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 690f91b5..c9a16e34 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,11 @@ } } }, + "resolutions": { + "elliptic": "^6.5.3" + }, "scripts": { + "preinstall": "npx npm-force-resolutions", "start": "meteor run", "debug": "meteor run --inspect", "lint": "run-s eslint yamllint jsonlint dockerlint markdownlint", From 6122e2c385062971e1aeb31e6967f74d956eced2 Mon Sep 17 00:00:00 2001 From: "Dale R. Hille" Date: Fri, 31 Jul 2020 10:08:57 -0400 Subject: [PATCH 5/5] removing unsafe-perm true --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8a8d0a8d..085ee22e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,6 @@ RUN apk update \ && apk add ${BUILD_PACKAGES} \ && mkdir -p /root \ && mkdir -p /app \ - && npm config set unsafe-perm true \ && $METEORD_DIR/build_app.sh \ && apk del --purge ${BUILD_PACKAGES} \ && $METEORD_DIR/clean-final.sh