查看“︁编程语言/Drone/drone-volume-cache”︁的源代码
来自康健生活
←
编程语言/Drone/drone-volume-cache
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 标题文本 == [https://github.com/drillster/drone-volume-cache drillster/drone-volume-cache]: Drone plugin for caching to a locally mounted volume. == 标题文本 == <syntaxhighlight lang="yaml"> - name: restore-cache # 把之前缓存好的数据取出 image: drillster/drone-volume-cache settings: restore: true mount: # 缓存挂载的文件夹 - ./.npm-cache - ./node_modules volumes: - name: cache path: /cache</syntaxhighlight> <syntaxhighlight lang="yaml"> kind: pipeline type: docker #在docker runner中运行 name: web #定义setups,每个setup有属于自己的name,最后会显示在Drone CI管理页面的侧边栏 steps: - name: restore-cache # 把之前缓存好的数据取出 image: drillster/drone-volume-cache settings: restore: true mount: # 缓存挂载的文件夹 - ./.npm-cache - ./node_modules volumes: - name: cache path: /cache - name: compile #编译 image: node:12 commands: - yarn config set registry https://registry.npm.taobao.org -g - yarn config set cache ./.npm-cache --global - yarn install - yarn run build - name: build image #打成docker镜像 image: docker failure: ignore volumes: - name: sock path: /var/run/docker.sock commands: - docker build -t localhost:v1.0 -f Dockerfile . - docker image prune -f --filter "dangling=true" # 清理无用镜像 - name: rebuild-cache # 把依赖和 npm 缓存放到缓存里 image: drillster/drone-volume-cache settings: rebuild: true mount: - ./.npm-cache - ./node_modules volumes: - name: cache path: /cache - name: deploy #部署到服务器上 image: docker failure: ignore volumes: - name: sock path: /var/run/docker.sock commands: - docker service ls|grep test || export SERVICE=down #先检查服务是否存在,存在更新,不存在创建 - | if [ "$SERVICE" != "down" ] then docker service update --image test:v1.0 test_test else docker stack deploy -c deploy.yaml autocd-web fi # 循环检测服务是否启动成功 - | while true do docker service ps test_test|awk '{print $6}'|awk 'NR==2'|grep 'Running' || export SERVICE=down if [ "$SERVICE" == "down" ] then echo -e "\033[5;35;40m 正在启动中请稍后 ... \033[0m" export SERVICE=up continue else docker service logs -n 200 test_test sleep 3 break fi done # 挂载宿主机文件到docker容器中 volumes: - name: sock host: path: /var/run/docker.sock - name: cache host: path: /tmp/cache # 创建触发器,绑定分支及事件及上一次成功时才运行 trigger: branch: - master event: - pull_request - push status: - success - failure node: machine1:runner1 </syntaxhighlight>
返回
编程语言/Drone/drone-volume-cache
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。