Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no entry file inside docker image #66

Closed
andrewkslv opened this issue Sep 16, 2017 · 3 comments
Closed

no entry file inside docker image #66

andrewkslv opened this issue Sep 16, 2017 · 3 comments

Comments

@andrewkslv
Copy link
Member

Docker can't find server.js file inside the image. The way to reproduce:

$ node tools/publish.js foobar
$ docker run -p 8080:8080 api

response:

Error: Cannot find module '/usr/src/app/build/server.js'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:453:25)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:201:16)
    at bootstrap_node.js:626:3
@koistya
Copy link
Member

koistya commented Sep 17, 2017

Try running this:

$ docker-compose run --rm --no-deps api yarn        # Install Node.js dependencies
$ docker-compose run --rm --no-deps api yarn build  # Compile the app into ./build
$ docker build --no-cache --tag api .               # Build the production "api" image
$ docker run --rm -p 8080:8080 api                  # Check if it works
$ docker run --rm api ls /usr/src/app/build         # Show the files inside the image

@koistya
Copy link
Member

koistya commented Sep 17, 2017

@eclipticwld the current setup expects you to build the app first, then run docker build command that copies all the compiled output into the image (COPY . .), see Dockerfile. It is possible though to tweak Dockerfile so that it would build the app during image compilation and then prune non-production dependencies. Please, let me know if the later workflow works better for you.

@andrewkslv
Copy link
Member Author

Thank you @koistya! That was helpful to move forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants