diff --git a/Dockerfile b/Dockerfile index cdd2839e..085ee22e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,12 +16,7 @@ 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 \ && $METEORD_DIR/build_app.sh \ - && $METEORD_DIR/rebuild_npm_modules.sh \ && apk del --purge ${BUILD_PACKAGES} \ && $METEORD_DIR/clean-final.sh 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", 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 3b4cbe5b..523f7b11 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 +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 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