.drone.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. kind: pipeline
  2. type: docker
  3. name: dev
  4. node:
  5. mode: local_test
  6. steps:
  7. # - name: yarn-install
  8. # image: gplane/pnpm:node20
  9. # volumes:
  10. # - name: modules-cache
  11. # path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  12. # commands:
  13. # # - yarn build
  14. # # - pnpm config set registry https://registry.npmmirror.com/
  15. # # - pnpm install
  16. # # - pnpm run build
  17. # - pnpm serve
  18. - name: build
  19. image: docker:20.10.7
  20. # depends_on: [yarn-install]
  21. volumes:
  22. - name: docker
  23. path: /var/run/docker.sock
  24. - name: modules-cache
  25. path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  26. environment:
  27. IMAGE: registry.yingcaibx.com/tl/admin_web:latest
  28. commands:
  29. # 清理 docker 服务中不再使用的镜像、挂载、网络等资源
  30. - docker system prune --force --volumes || true
  31. - docker build -f ./Dockerfile -t $IMAGE ./
  32. - name: run
  33. image: docker/compose
  34. depends_on: [build]
  35. volumes:
  36. - name: docker
  37. path: /var/run/docker.sock
  38. commands:
  39. - docker-compose -f docker-compose-dev.yml up -d
  40. trigger:
  41. branch:
  42. - dev
  43. event:
  44. - push
  45. volumes:
  46. - name: docker
  47. host:
  48. path: /var/run/docker.sock
  49. - name: modules-cache
  50. host:
  51. path: /data/cache/tl/new1_web
  52. ---
  53. kind: pipeline
  54. type: docker
  55. name: pre
  56. node:
  57. mode: local_pre
  58. steps:
  59. - name: yarn-install
  60. image: gplane/pnpm:node20
  61. volumes:
  62. - name: modules-cache
  63. path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  64. commands:
  65. - pnpm config set registry https://registry.npmmirror.com/
  66. - pnpm install
  67. - pnpm run build
  68. - name: build
  69. image: docker:20.10.7
  70. depends_on: [yarn-install]
  71. volumes:
  72. - name: docker
  73. path: /var/run/docker.sock
  74. environment:
  75. IMAGE: registry.yingcaibx.com/tl/admin_web:latest
  76. commands:
  77. # 清理 docker 服务中不再使用的镜像、挂载、网络等资源
  78. - docker system prune --force --volumes || true
  79. - docker build -f ./Dockerfile -t $IMAGE ./
  80. - name: run
  81. image: docker/compose
  82. depends_on: [build]
  83. volumes:
  84. - name: docker
  85. path: /var/run/docker.sock
  86. commands:
  87. - docker-compose -f docker-compose-pre.yml up -d
  88. trigger:
  89. branch:
  90. - pre
  91. event:
  92. - push
  93. volumes:
  94. - name: docker
  95. host:
  96. path: /var/run/docker.sock
  97. - name: modules-cache
  98. host:
  99. path: /data/cache/tl/web_new
  100. ---
  101. kind: pipeline
  102. type: docker
  103. name: release
  104. node:
  105. mode: local_test
  106. steps:
  107. - name: yarn-install
  108. image: gplane/pnpm:node20
  109. depends_on: [clone]
  110. volumes:
  111. - name: modules-cache
  112. path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  113. commands:
  114. - pnpm config set registry https://registry.npmmirror.com/
  115. - pnpm install
  116. - pnpm run build
  117. # - yarn install && yarn run build
  118. - name: push
  119. image: docker:20.10.7
  120. depends_on: [yarn-install]
  121. volumes:
  122. - name: docker
  123. path: /var/run/docker.sock
  124. environment:
  125. IMAGE: registry.yingcaibx.com/tl/admin_web
  126. commands:
  127. - docker login -u yxt -p qwe123QWE registry.yingcaibx.com
  128. - echo $DRONE_TAG
  129. - docker build -f ./Dockerfile -t $IMAGE:$DRONE_TAG ./
  130. - docker push $IMAGE:$DRONE_TAG
  131. - docker rmi $IMAGE:$DRONE_TAG
  132. trigger:
  133. event:
  134. - tag
  135. volumes:
  136. - name: docker
  137. host:
  138. path: /var/run/docker.sock
  139. - name: modules-cache
  140. host:
  141. path: /data/cache/tl/web