drone/.drone.yml
liupeng 50135c7231
Some checks failed
continuous-integration/drone/push Build is failing
docker升级
2024-03-05 18:49:28 +08:00

85 lines
1.6 KiB
YAML

kind: pipeline
name: default
#设置挂载
volumes:
#Go编译缓存
- name: pkgdeps
host:
path: /mnt/drone/cache/go
clone:
disable: false # 启用代码拉取
steps:
#构建镜像
# - name: build
# image: golang:latest
# pull: if-not-exists
# volumes:
# - name: pkgdeps
# path: /go/pkg
# environment:
# GOPROXY: "https://goproxy.cn,direct" # 懂的都懂
# commands:
# - CGO_ENABLED=0 go build -o adapt -ldflags="-w -s"
# when:
# branch:
# - master
# - dev
# event:
# - push
# 开发版
- name: docker-${DRONE_BRANCH}
image: plugins/docker
settings:
username: liupeng
password:
from_secret: DOCKER_PASSWORD
registry: git.daymele.com
repo: git.daymele.com/liupeng/drone
insecure: true
debug: true
dockerfile: Dockerfile
tags:
- latest
when:
branch:
- master
- dev
event:
- push
- name: deploy-${DRONE_BRANCH}
image: appleboy/drone-ssh
settings:
host:
- dev.daymele.com
username: liup
# password:
# from_secret: HOST_PASSWORD
key:
from_secret: HOST_KEY
port: 22
command_timeout: 2m
script:
- echo "deploy docker ssh!"
- name=drone-test
- image=git.daymele.com/liupeng/drone:latest
- echo ${DRONE_BRANCH}
- docker pull $image
- docker rm -f drone-test || true
- docker image prune -f
- docker run --name=$name -d -p 8001:9000 -v /etc/conf:/conf $image
when:
branch:
- master
- dev
event:
- push