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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
kind : pipeline
type : docker
name : master
steps :
- 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
volumes : # 将容器内目录挂载到宿主机, 仓库需要开启Trusted设置
- name : maven-build
path : /app/build # 将应用打包好的Jar和执行脚本挂载出来
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
- cp target/lingnuo-0.0.1.jar /app/build/lingnuo-0.0.1.jar
- cp Dockerfile /app/build/Dockerfile
- cp run.sh /app/build/run.sh
- 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"
# - name: scp files
# image: appleboy/drone-scp
# settings:
# host: 121.41.171.43
# username:
# from_secret: linac
# password:
# from_secret: linac
# port: 22
# target: /root
# source: /target/*
- name : ssh
image : appleboy/drone-ssh
settings :
host : 121.41 .171 .43
username :
from_secret : linac_user
password :
from_secret : linac_secreat
port : 22
command_timeout : 5m
script :
- cd /data/wwwroot/docker/maven/build # 进入宿主机构建目录
- 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
volumes : # 定义流水线挂载目录,用于共享数据
- name : maven-build
host :
path : /data/wwwroot/docker/maven/build # 从宿主机中挂载的目录
- name : cache
host :
path : "/var/lib/cache"
trigger :
branch :
- master
event :
- push
- merge