.drone.yml 1.9 KB

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