ctco / nodejs-graphql-template

Template project for Node.js® GraphQL APIs
MIT License
14 stars 3 forks source link

Issue #11 Docker support #115

Closed trioletas closed 7 years ago

trioletas commented 7 years ago

👷 Work in progress:

trioletas commented 7 years ago

Thanks for looking at the prod image. imma look in to pm2 integration for prod as well - wonder if it makes sense to use it in a container environment.

trioletas commented 7 years ago

Added the multi stage built support, pm2 shelved for now, will work on dev mode.

jelisejev commented 7 years ago

@trioletas does adding multi stage builds reduce the size in this particular case?

trioletas commented 7 years ago

Multi step builds serve the purpose of simplifying the dockerfile structure by making the usual clean up after yourself routine unnecessary. You can definitely get the same image size without them, but it's not as future proof to do the manual clean up.

trioletas commented 7 years ago

There was a bug in the non-multistage implementation with original node modules folder with all dev dependencies being present in the final image. I've decided to go with this approach to avoid these sort of mishaps with a more maintainable structure

trioletas commented 7 years ago

Dev mode is now properly supported with dedicated Dockerfile and docker-compose. Compilation and linting runs in the container, source code directory is attached as a volume mount. I don't see a way how to reuse the productive Dockerfile at the moment. Tested in OS X native and windows docker toolbox, looking for volunteers to test other setups as well.

trioletas commented 7 years ago

@aeldar would be nice if you could assist us by testing the development set up on Linux machine, I remember that you have one available.

thanks in advance!

aeldar commented 7 years ago

@trioletas works for me. Checked on the following configuration:

Changes in the source files were reflected in a container runtime.

trioletas commented 7 years ago

Thanks a lot Eldar !