jshimko / meteor-launchpad

A base Docker image for Meteor applications.
https://hub.docker.com/r/jshimko/meteor-launchpad/
MIT License
276 stars 152 forks source link

Docker Build fails when reaching Meteor Download, using todos-master example project from meteor with: returned a non-zero code #89

Closed Big-al closed 6 years ago

Big-al commented 6 years ago

EDIT: if you are new to Docker, please read the issue thread below as it describes in detail how to get a test project running from start to finish. The issue description wasn’t the real problem for me. The real problem was with the todos-master example project by Meteor.

I set up a directory with the Docker file containing the FROM path. I Tried to build it, and it starts, but after the naturally never endning stream of Node modules, when Meteor is to be installed, i get the following:

> 100  7786    0  7786    0     0   5092      0 --:--:--  0:00:01 --:--:--  5092
> * Connection #0 to host install.meteor.com left intact
> head: cannot open '/opt/meteor/src/.meteor/release' for reading: No such file or                                         directory
>
> [-] Installing Meteor ...
>
> Downloading Meteor distribution
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> Retrying download in 5 seconds...
> The command '/bin/sh -c cd $APP_SOURCE_DIR &&   $BUILD_SCRIPTS_DIR/install-deps.                            sh &&   $BUILD_SCRIPTS_DIR/install-node.sh &&   $BUILD_SCRIPTS_DIR/install-phant                             om.sh &&   $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh &&   $BUILD_SCRIPTS_DIR/                           install-mongo.sh &&   $BUILD_SCRIPTS_DIR/install-meteor.sh &&   $BUILD_SCRIPTS_D                         IR/build-meteor.sh &&   $BUILD_SCRIPTS_DIR/post-build-cleanup.sh' returned a non                                        -zero code: 1

Am i missing something?

jshimko commented 6 years ago

Looks like your Dockerfile isn't in a Meteor app directory. If it was, the .meteor/release file would exist.

Big-al commented 6 years ago

I moved your docker setup to my Meteor project, and ran docker build -t sometestname /pathtoproject and i checked the log, didnt seem to be any problems, all the scripts ran successfully making my job a lot easier. Thank you for you great work. I am hitting an error when running docker run sometestname however.

docker run sometestname
container_linux.go:265: starting container process caused "exec: \"./entrypoint.sh\": stat ./entrypoint.sh: no such file or directory"
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./entrypoint.sh\": stat ./entrypoint.sh: no such file or directory".

Seems entrypoint.sh is not available. From what i gather, it is a windows problem, but i am very new to Docker and only just finished reading the documentation.

I did follow steps according to this issue: https://github.com/docker/compose/issues/4039 , all while running them in all of kitematic(elevated), Powershell(elevated) and git bash(elevated) on a Dell XPS 9550 with windows 10 pro, running hypepr-V.

I tried the following steps so far:

These steps unfortunately didnt work.

Current status of the image according to Kitematic: No volumes are attached. capture

Tried this as well as you mentioned in this issue: https://github.com/reactioncommerce/base/issues/1 i tried cd'ing into testname directory and running in elevated bash bash build.sh. resulting in the following error, at step 15/42 :

Step 15/42 : RUN bash $BUILD_SCRIPTS_DIR/install-deps.sh && 
bash $BUILD_SCRIPTS_DIR/post-install-cleanup.sh
 ---> Running in 9518877e3f1b
/opt/build_scripts/install-deps.sh: line 2: $'\r': command not found
: invalid optionts/install-deps.sh: line 3: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/opt/build_scripts/install-deps.sh: line 4: $'\r': command not found

[-] Installing base OS dependencies...

/opt/build_scripts/install-deps.sh: line 6: $'\r': command not found
/opt/build_scripts/install-deps.sh: line 8: $'\r': command not found
E: Invalid operation update
/opt/build_scripts/install-deps.sh: line 10: $'\r': command not found
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package apt-transport-https
E: Unable to locate package ca-certificates
/opt/build_scripts/install-deps.sh: line 14: $'\r': command not found
/opt/build_scripts/install-deps.sh: line 46: syntax error: unexpected end of file
The command '/bin/sh -c bash $BUILD_SCRIPTS_DIR/install-deps.sh && 
bash $BUILD_SCRIPTS_DIR/post-install-cleanup.sh' returned a non-zero code: 2
jshimko commented 6 years ago

If you can provide a repo with an example app that can reproduce this, I'd be happy to take a look. But I don't really know what else to suggest since I've never seen any of these errors and many people use this project to build Meteor images every day.

Does this work for you?

meteor create testapp
cd testapp

echo "FROM jshimko/meteor-launchpad:latest" > Dockerfile

docker build -t testbuild .
Big-al commented 6 years ago

I've narrowed down the issue. I was using the todos-master example project from meteor's own repo, which was running 1.4.4.1 . Apparently it is causing an issue with your docker image as described above. To reproduce: System: WIndows 10, profesional

Using Elevated CMD or Git BASH: -> Download Meteors example project todos-master from: https://github.com/meteor/todos -> cd todos-master -> echo FROM jshimko/meteor-launchpad:latest > Dockerfile -> docker build -t todos-master .

You should be met with the following error:

> [-] Building Meteor application...
> 
> 
> 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
> 
> WARN: Output exceeds 32000 characters
> WARN: Output exceeds 32000 characters
> /opt/build_scripts/build-meteor.sh: line 27:  4780 Segmentation fault      meteor build --directory $APP_BUNDLE_DIR --server-only
> The command '/bin/sh -c cd $APP_SOURCE_DIR &&   $BUILD_SCRIPTS_DIR/install-deps.sh &&   $BUILD_SCRIPTS_DIR/install-node.sh &&   $BUILD_SCRIPTS_DIR/install-phantom.sh &&   $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh &&   $BUILD_SCRIPTS_DIR/install-mongo.sh &&   $BUILD_SCRIPTS_DIR/install-meteor.sh &&   $BUILD_SCRIPTS_DIR/build-meteor.sh &&   $BUILD_SCRIPTS_DIR/post-build-cleanup.sh' returned a non-zero code: 139

Full log can be seen here: https://gist.github.com/Big-al/8ba3258025ecd84725a2020eaf3232b7

Your steps worked as advertised. the problem lies with the standard todos-master example app it seems or version 1.4.4.1. Installing meteor locally using meteors own described method (installing chocolatey for windows, then running choco install meteor), and then following your post above results in the standard meteor 1.6 image running on locahost at port 3000 per default. If anyone else is reading this, remember that echo actually prints the “” into the dockerfile as well, so leave them out.

jshimko commented 6 years ago

Since this isn't an issue with this project, I'm going to close the issue. Feel free to reopen if you discover otherwise.

Also, keep in mind that if you want to use an older version of Meteor, you need to specify the version of Node that it supports. This image will install the correct version of Meteor for you, but it doesn't know to install an older version of Node based on that Meteor version (yet). By default, this image installs the latest version of Node that is supported by the latest stable release of Meteor.

For example, the current 1.6.x release of Meteor is Node 8.x, but the Meteor 1.4.1.1 app you tried definitely does not support Node 8 and definitely will not run. The proper way to ensure the correct Node version for your app is by using the build arg mentioned in the readme.

docker build --build-arg NODE_VERSION=4.8.3 -t my-app .