- npm
npm run run
- start servernpm run lint
- lint codenpm run build
- build typescript intobuild
dirnpm run dev
- start dev server (nodemon)npm run dev:debug
- start nodemon with debuggernpm run test
- run testsnpm run test:watch
- run tests in watch modenpm run start
- run built code with bare node - used for CF
- docker
bin/docker-build.sh
- build docker container from command line (supposes bash environment)bin/docker-run.sh
- run the built above container, add-d
arg to run detachedbin/docker-test.sh
- test the container (must be built before) - requests /healthz API end pointbin/docker-cleanup.sh
- cleanups docker stuff: removes inactive containers, untagged images (use with care)
... Though prefer the scripts above.
-
docker build -f docker/Dockerfile -t abaplint-backend .
- build -
docker run --rm -p 3000:3000 abaplint-backend
- run attached -
docker run --rm -p -d 3000:3000 abaplint-backend
- run detached (in background) -
docker-compose -f docker/docker-compose.yml --project-directory . up
- same but with the compose -
docker-compose -d -f docker/docker-compose.yml --project-directory . up
- detached -
docker ps
- running containers -
docker ps -a
- all created container (including exited) -
docker stop <id>
- stop specific container e.g. started detached -
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
- remove stopped containers -
docker image prune
- remove dangling images (no tag) -
docker image prune -a
- remove all unused images
Check all of this works, if you change CI flows
npm run run
npm run build && npm run start
npm run dev
bin/docker-build.sh
,bin/docker-run.sh -d
,bin/docker-test.sh
,bin/docker-cleanup.sh
- docker build and deploy flow in Github actions
- https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
- maybe integrate better server closing: https://github.com/BretFisher/node-docker-good-defaults/blob/69c923bc646bc96003e9ada55d1ec5ca943a1b19/bin/www or use
stoppable
package ? - https://www.slideshare.net/Docker/dcsf-19-nodejs-rocks-in-docker-for-dev-and-ops