.drone.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. kind: pipeline
  2. name: default
  3. type:
  4. steps:
  5. - name: build
  6. image: maven:3.8.1-openjdk-8
  7. volumes:
  8. - name: cache # The Volume's name
  9. path: /root/.m2 # The path in the container
  10. commands:
  11. #- mvn help:effective-settings # check maven
  12. - ls -hl /root/.m2/
  13. - mvn -version
  14. - java -version
  15. - mvn help:effective-settings
  16. - mvn clean package -DskipTests
  17. - name: docker
  18. image: plugins/docker
  19. volumes:
  20. - name: dockersock
  21. path: /var/run/docker.sock
  22. settings:
  23. username: root
  24. password: $jgkj001
  25. # from_secret: zhuotong
  26. debug: true
  27. # launch_debug: true
  28. #insecure: true
  29. #mirror: https://mgjrzxtn.mirror.aliyuncs.com
  30. #registry: 192.168.1.100:10000
  31. #repo: 192.168.1.100:10000/library/railway-admin
  32. # purge: true
  33. tags:
  34. - ${DRONE_COMMIT_SHA:1.0.0}
  35. - ${DRONE_COMMIT}
  36. - v1
  37. - latest
  38. - name: deploy
  39. image: appleboy/drone-ssh
  40. settings:
  41. host: railway.iamsee.com
  42. username: root
  43. password: $jgkj001
  44. debug: true
  45. script:
  46. - export PATH=/usr/local/bin:$PATH
  47. - echo $PATH
  48. # - a=`docker ps -a | grep "railway-admin" | awk '{print $1 }'` && [[ ${#a} -ne "" ]] && docker stop "${a}" && docker rm "${a}"
  49. - export has=`docker ps -a | grep "railway-admin$" | wc -l`
  50. - export id=`docker ps -a | grep "railway-admin$" | awk '{print $1 }'`
  51. - echo $has && echo $id && if [[ has -gt 0 ]] ; then docker stop $id && docker rm $id ; fi;
  52. - docker image rm 192.168.1.100:10000/library/railway-admin
  53. - docker run -itd --name railway-admin -p 2021:2021 iamsee/railway-admin:latest
  54. volumes:
  55. - name: cache # The name use in this pipeline,
  56. host:
  57. path: /tmp/cache # The path be used in the host.
  58. - name: dockersock
  59. host:
  60. path: /var/run/docker.sock