.gitlab-ci.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # usermod -aG docker gitlab-runner
  2. stages:
  3. - build
  4. - deploy
  5. variables:
  6. PROJECT_NAME: hyperf
  7. REGISTRY_URL: registry-docker.org
  8. build_test_docker:
  9. stage: build
  10. before_script:
  11. # - git submodule sync --recursive
  12. # - git submodule update --init --recursive
  13. script:
  14. - docker build . -t $PROJECT_NAME
  15. - docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:test
  16. - docker push $REGISTRY_URL/$PROJECT_NAME:test
  17. only:
  18. - test
  19. tags:
  20. - builder
  21. deploy_test_docker:
  22. stage: deploy
  23. script:
  24. - docker stack deploy -c deploy.test.yml --with-registry-auth $PROJECT_NAME
  25. only:
  26. - test
  27. tags:
  28. - test
  29. build_docker:
  30. stage: build
  31. before_script:
  32. # - git submodule sync --recursive
  33. # - git submodule update --init --recursive
  34. script:
  35. - docker build . -t $PROJECT_NAME
  36. - docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME
  37. - docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:latest
  38. - docker push $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME
  39. - docker push $REGISTRY_URL/$PROJECT_NAME:latest
  40. only:
  41. - tags
  42. tags:
  43. - builder
  44. deploy_docker:
  45. stage: deploy
  46. script:
  47. - echo SUCCESS
  48. only:
  49. - tags
  50. tags:
  51. - builder