Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 2.33 KB

dev-notes.md

File metadata and controls

54 lines (42 loc) · 2.33 KB

Docker Development Notes

Useful scripts

  • npm
    • npm run run - start server
    • npm run lint - lint code
    • npm run build - build typescript into build dir
    • npm run dev - start dev server (nodemon)
    • npm run dev:debug - start nodemon with debugger
    • npm run test - run tests
    • npm run test:watch - run tests in watch mode
    • npm 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 detached
    • bin/docker-test.sh - test the container (must be built before) - requests /healthz API end point
    • bin/docker-cleanup.sh - cleanups docker stuff: removes inactive containers, untagged images (use with care)

Manual commands

... 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

CI check list

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

Cool

Best Practices