start.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # @Contact : liuyuqi.gov@msn.cn
  3. # @Time : 2024/03/19 17:10:56
  4. # @License : (C)Copyright 2022 liuyuqi.
  5. # @Desc :
  6. ###############################################################################
  7. set -e
  8. sex -x
  9. docker compose -f "docker-compose.debug.yml" up -d --build
  10. cd backend
  11. pip isntall poetry
  12. poetry install
  13. poetry shell
  14. python main.py
  15. function run(){
  16. uvicorn app:app --reload
  17. }
  18. function docker_compose_build() {
  19. docker compose build -f docker-compose.debug.yml
  20. docker compse down -v --remove-orphans
  21. docker compose up -d
  22. docker compose exec -T backend bash /app/tests-start.sh "$@"
  23. docker compose down -v --remove-orphans
  24. TAG= ${TAG?Variable not set} \
  25. FRONTEND_ENV=${FRONTEND_ENV-production} \
  26. sh ./scripts/build.sh
  27. docker compose -f docker-compose.debug.yml push
  28. }
  29. function deploy() {
  30. DOMAIN=${DOMAIN?Variable not set} \
  31. STACK_NAME=${STACK_NAME?Variable not set} \
  32. TAG=${TAG?Variable not set} \
  33. docker-compose \
  34. -f docker-compose.yml \
  35. config > docker-stack.yml
  36. docker-auto-labels docker-stack.yml
  37. docker stack deploy -c docker-stack.yml --with-registry-auth "${STACK_NAME?Variable not set}"
  38. }