docker build -t infra-101-best-ever .
docker run --rm infra-101-best-ever npm test
docker run -p 3000:3000 --rm infra-101-best-ever
docker run --rm -it infra-101-best-ever sh
Rebuilding the docker image to reflect code changes is time consuming. You can bypass this by mounting the local file system to the docker container using the -v flag:
docker run --rm -v $(pwd):/app infra-101-best-ever npm install
Running tests:
docker run --rm -v $(pwd):/app infra-101-best-ever npm test
A makefile can simplify invoking the above commands.
make build
: Build docker image for appmake shell
: Open interactive shell for docker containermake test
: Run tests in docker containermake start
: Start app in docker container