abernix / meteord

MeteorD - Docker Runtime for Meteor Apps for Production Deployments
https://registry.hub.docker.com/u/meteorhacks/meteord/
MIT License
93 stars 129 forks source link

[Build Error] /opt/meteord/lib/build_app.sh: line 21: 84 Killed meteor build --allow-superuser --directory $BUNDLE_DIR --server=http://localhost:3000 #38

Closed WayneUong closed 5 years ago

WayneUong commented 6 years ago

I got this error when trying docker build -t yourname/app . After Node#moveTo was deprecated. Use Container#append. it stays silent for 20-30 minutes, then this error shows.

Sending build context to Docker daemon  9.252MB
Step 1/1 : FROM abernix/meteord:onbuild
onbuild: Pulling from abernix/meteord
c20dc0c5afeb: Pull complete 
a3ed95caeb02: Pull complete 
52781f451a84: Pull complete 
5f8feca11b31: Pull complete 
649129398dc3: Pull complete 
926d0760afad: Pull complete 
5a6214b54a5e: Pull complete 
Digest: sha256:3c5bc7c2759e91038478723da93fcc657eddf0d863ce6c95551cc60e7eb396fd
Status: Downloaded newer image for abernix/meteord:onbuild
# Executing 4 build triggers
 ---> Running in a23128a38a7d
Removing intermediate container a23128a38a7d
 ---> Running in 3ac49e5d3d5d
Downloading Meteor distribution

Meteor 1.7.0.1 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.

To get started fast:

  $ meteor create ~/my_cool_app
  $ cd ~/my_cool_app
  $ meteor

Or see the docs at:

  docs.meteor.com

Removing intermediate container 3ac49e5d3d5d
 ---> Running in 17f3fedcc3c8
=> Copying the app
+ COPIED_APP_PATH=/copied-app
+ BUNDLE_DIR=/tmp/bundle-dir
+ echo '=> Copying the app'
+ cp -R /app /copied-app
=> Executing NPM install --production
+ cd /copied-app
+ echo '=> Executing NPM install --production'
+ meteor npm install --production

> bcrypt@2.0.1 install /copied-app/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "/copied-app/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
added 320 packages from 577 contributors in 12.075s
[!] 5 vulnerabilities found [777 packages audited]
    Severity: 1 Low | 4 High
    Run `npm audit` for more detail

+ echo '=> Executing Meteor Build...'
+ export
+ meteor build --allow-superuser --directory /tmp/bundle-dir --server=http://localhost:3000
=> Executing Meteor Build...
declare -x HOME="/root"
declare -x HOSTNAME="f4c507225b25"
declare -x METEORD_DIR="/opt/meteord"
declare -x NODE_VERSION="4.8.7"
declare -x OLDPWD="/"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -x PWD="/copied-app"
declare -x SHLVL="1"

Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
directory will be incorrect if you ever attempt to perform any Meteor tasks as
a normal user. If you need to fix your permissions, run the following command
from the root of your project:

  sudo chown -Rh <username> .meteor/local

Node#moveTo was deprecated. Use Container#append.
/opt/meteord/lib/build_app.sh: line 21:    84 Killed                  meteor build --allow-superuser --directory $BUNDLE_DIR --server=http://localhost:3000
The command '/bin/sh -c bash $METEORD_DIR/lib/build_app.sh' returned a non-zero code: 137
klokie commented 6 years ago

Hi, we're seeing essentially the same behavior when trying to build with Gitlab Runner in a Kubernetes cluster. The build process appears to get stuck after line 21.

Is there a good way to debug the process, other than forking this repository and adding some more echo statements?

abernix commented 5 years ago

Most likely this is an out-of-memory condition caused by what is almost always a very minification process by Terser/Uglify.

A Rust-based minifier would go a long ways! :smile: 👀 https://github.com/GuillaumeGomez/minifier-rs

Anyhow, unfortunately, I'm certain that additional debugging would yield this as the problem. If you can provide more memory to the image, and increase Node memory usage by setting the environment variable NODE_OPTIONS=--max-old-space-size=<larger number in MB>, you might have better luck!