.drone.yml 1.8 KB

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