关于使用gogs配置私有git并发布
安装gogs
docker run -itd --name=gogs -p 9000:22 -p 8000:3000 -v /gogs:/data gogs/gogs
安装drone
docker run -itd -e DRONE_AGENTS_ENABLED=true -v /drone:/data -e DRONE_USER_CREATE=username:lhc,machine:false,admin:true,token:2e363d3187145b7b3bda0670976f89f9 -e DRONE_GOGS_SERVER=http://ip:8000 -e DRONE_RPC_SECRET=EQm0GoGRAAAAEXJvb3RAZmFmMWU2OGNhYzMxAQIDBA -e DRONE_SERVER_HOST=ip:9010 -e DRONE_SERVER_PROTO=http -p 9010:80 -p 9020:443 --restart=always --name drone drone/drone:2
安装drone-runner-docker
docker run -d -e DRONE_RPC_PROTO=http -e DRONE_RPC_HOST=ip:9010 -v /var/run/docker.sock:/var/run/docker.sock -e DRONE_RPC_SECRET=EQm0GoGRAAAAEXJvb3RAZmFmMWU2OGNhYzMxAQIDBA -e DRONE_RUNNER_CAPACITY=2 -e DRONE_RUNNER_NAME=drone-runner -p 9040:3000 --restart=always --name=runner --link=drone:drone drone/drone-runner-docker:1
drone.yml
kind: pipeline
type: docker
name: demo
steps:
- name: build
image: node:14.17.0
commands:
- npm i cnpm -g
- cnpm i
- npm run build
- name: drone-scp
image: appleboy/drone-scp
settings:
host:
from_secret: host
username:
from_secret: username
password:
from_secret: password
port: 22
target: /dist
source:
- /drone/src/dist
rm: true
//它在管道启动时创建,在管道完成后销毁
本例子使用的是Vue项目
将/drone/src/dist的文件上传到服务器/dist目录
|