.drone.yml 1.9 KB

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