.drone.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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-Dev -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. - name: modules-cache
  75. path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  76. environment:
  77. IMAGE: registry.yingcaibx.com/tl/admin_web:latest
  78. commands:
  79. # 清理 docker 服务中不再使用的镜像、挂载、网络等资源
  80. - docker system prune --force --volumes || true
  81. - docker build -f ./Dockerfile-Dev -t $IMAGE ./
  82. - name: run
  83. image: docker/compose
  84. depends_on: [build]
  85. volumes:
  86. - name: docker
  87. path: /var/run/docker.sock
  88. commands:
  89. - docker-compose -f docker-compose-pre.yml up -d
  90. trigger:
  91. branch:
  92. - pre
  93. event:
  94. - push
  95. volumes:
  96. - name: docker
  97. host:
  98. path: /var/run/docker.sock
  99. - name: modules-cache
  100. host:
  101. path: /data/cache/tl/web_new
  102. ---
  103. kind: pipeline
  104. type: docker
  105. name: release
  106. node:
  107. mode: local_test
  108. steps:
  109. - name: yarn-install
  110. image: gplane/pnpm:node20
  111. depends_on: [clone]
  112. volumes:
  113. - name: modules-cache
  114. path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
  115. commands:
  116. - pnpm config set registry https://registry.npmmirror.com/
  117. - pnpm install
  118. - pnpm run build
  119. # - yarn install && yarn run build
  120. - name: push
  121. image: docker:20.10.7
  122. depends_on: [yarn-install]
  123. volumes:
  124. - name: docker
  125. path: /var/run/docker.sock
  126. environment:
  127. IMAGE: registry.yingcaibx.com/tl/admin_web
  128. commands:
  129. - docker login -u yxt -p qwe123QWE registry.yingcaibx.com
  130. - echo $DRONE_TAG
  131. - docker build -f ./Dockerfile -t $IMAGE:$DRONE_TAG ./
  132. - docker push $IMAGE:$DRONE_TAG
  133. - docker rmi $IMAGE:$DRONE_TAG
  134. trigger:
  135. event:
  136. - tag
  137. volumes:
  138. - name: docker
  139. host:
  140. path: /var/run/docker.sock
  141. - name: modules-cache
  142. host:
  143. path: /data/cache/tl/web