You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.2 KiB

2 years ago
kind: pipeline
type: docker
name: master
steps:
2 years ago
- name: restore-cache
image: meltwater/drone-cache
settings:
backend: filesystem
restore: true
cache_key: "maven"
archive_format: gzip
filesystem_cache_root: "/var/lib/cache"
mount:
- "maven"
volumes:
- name: cache
path: "/var/lib/cache"
# Do stuff..
- name: build
image: maven:3.8-openjdk-8
commands:
- mkdir /root/.m2
- cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml
- sed -i 's/\\/usr\\/share\\/maven\\/ref\\/repository/\\/drone\\/src\\/maven/g' /root/.m2/settings.xml
- mvn package
- name: rebuild-cache
image: meltwater/drone-cache
settings:
backend: filesystem
rebuild: true
cache_key: "maven"
archive_format: gzip
filesystem_cache_root: "/var/lib/cache"
mount:
- "maven"
volumes:
- name: cache
path: "/var/lib/cache"
2 years ago
- name: scp files
image: appleboy/drone-scp
2 years ago
settings:
2 years ago
host: 121.41.171.43
2 years ago
username:
2 years ago
from_username: linac
2 years ago
password:
2 years ago
from_secret: linac.
2 years ago
port: 22
2 years ago
target: /root
2 years ago
source: /build/target/*
2 years ago
- name: ssh
image: appleboy/drone-ssh
settings:
host: 121.41.171.43
username:
2 years ago
from_username: linac
2 years ago
password:
2 years ago
from_secret: linac.
2 years ago
port: 22
command_timeout: 5m
script:
- cd /work # 进入宿主机构建目录
- chmod +x run.sh # 更改为可执行脚本
- ./run.sh # 运行脚本打包应用镜像并运行
# - name: docker
# image: plugins/docker
# settings:
# dockerfile: "Dockerfile"
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
# tags:
# - master
2 years ago
volumes:
2 years ago
- name: cache
host:
path: "/var/lib/cache"
2 years ago
trigger:
2 years ago
branch:
- master
event:
- push
- merge