docker run -it -d -v "$(PWD)":/app -v /app/node_modules -w /app -p 8080:8080 --name my_project node:8 /bin/bash
Notice how we mount new volume above
node_modules
folder. In this way, we significantly improve performance for host machines powered by OSX or Windows. Otherwise, we will stay with a poor native performance when the Docker synchronize file system state on host and container onnpm install
command execution.
docker exec -it my_project npm install
docker stop my_project
docker rm my_project
docker volume prune
docker start my_project
docker exec -it my_project /bin/bash
docker start my_project
docker exec -it my_project npm run test
build:
docker run -it -d -v '$(CURDIR)':/app -v /app/node_modules -w /app -p 8080:8080 --name my_project node:8 /bin/bash
docker exec -it my_project npm install
clean:
docker stop my_project
docker rm my_project
docker volume prune
rebuild: clean build
start:
docker start my_project
connect: start
docker exec -it my_project /bin/bash
test: start
docker exec -it my_project npm run test
Then just execute any of those like make build