2022-11-15 15:32:43 +08:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: jar-deploy
|
|
|
|
trigger:
|
|
|
|
event: [ push ]
|
2022-11-15 16:29:30 +08:00
|
|
|
branch: [ master ]
|
2022-11-15 15:32:43 +08:00
|
|
|
steps:
|
|
|
|
- name: build-package
|
|
|
|
image: maven:3.8-openjdk-8
|
|
|
|
volumes:
|
|
|
|
- name: maven-cache
|
|
|
|
path: /root/.m2
|
|
|
|
- name: maven-build
|
|
|
|
path: /app/build
|
|
|
|
commands:
|
|
|
|
- mvn clean package # 应用打包命令
|
|
|
|
- cp target/scenic-1.0-SNAPSHOT.jar /app/build/scenic-1.0-SNAPSHOT.jar
|
|
|
|
- cp Dockerfile /app/build/Dockerfile
|
|
|
|
- cp run.sh /app/build/run.sh
|
|
|
|
- name: deploy-start
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host: 1.116.245.89
|
|
|
|
username: root
|
|
|
|
password:
|
|
|
|
from_secret: ssh_password
|
|
|
|
port: 22 # 远程连接端口
|
|
|
|
command_timeout: 5m
|
|
|
|
script:
|
|
|
|
- cd /root/docker/maven/build
|
|
|
|
- chmod +x run.sh
|
|
|
|
- ./run.sh
|
|
|
|
# when:
|
|
|
|
# event:
|
|
|
|
# - promote
|
|
|
|
volumes:
|
|
|
|
- name: maven-build
|
|
|
|
host:
|
|
|
|
path: /root/docker/maven/build
|
|
|
|
- name: maven-cache
|
|
|
|
host:
|
|
|
|
path: /root/docker/maven/cache
|