Docker driven development
Because npm install
is slow and I mean terribly slow when you try to use it properly with Docker for development.
Which means that you should run npm install
every time you will create Docker container, or change branch, to have truly clean environment. When you have Docker images with node_modules
baked in, you can skip this step and avoid all npm install
issues. Only tricky part is how to build and run these images and how to mark them, so you, fellow developers and ci servers can reuse them.
Using Soos will simplify all of that, apart from building image it will also allow you to run image with right node_modules
with single command in miliseconds. As a bonus you are forced into Docker driven development, which is speeding up onboarding and preventing issues caused by different environment setup.
Soos will do following
- Initalize
Dockerfile
and.dockerignore
for your project - Build docker image with
node_modules
baked in and will use shasum ofpackage.json
file as docker image tag, so you can easily switch between revisions ( see list of Soos own Docker images https://hub.docker.com/r/ngparty/soos/tags/ ) - Run docker container for your specific
package.json
, again using shasum of your package.json
!!! Setup Docker Mac or Docker Windows on your machine first !!!
$ npm i soos -g
Your/Project $ soos -i
Your/Project $ soos -b
Push/Publish docker image to Docker Hub
Your/Project $ soos -P
Your/Project $ soos
with bash
shell and with forwarded port 8080
Your/Project $ soos -c bash -p 8080
or
Your/Project $ soos -s -p 8080
Usage: soos [options]
Options:
--init, -i add dockerfile [boolean]
--build, -b build docker image [boolean]
--push, -P push docker image [boolean]
--command, -c command to run inside of docker [array]
--shell, -s run bash command inside of docker [boolean]
--port, -p port forwarding [string]
--help, -h Show help [boolean]
Examples:
soos -i && soos -b && soos -c bash Will build docker image and then start
docker machine with bash