编程语言/Drone/drone-volume-cache:修订间差异
来自康健生活
| 第14行: | 第14行: | ||
path: /cache</syntaxhighlight> | path: /cache</syntaxhighlight> | ||
<syntaxhighlight lang="yaml"> | |||
kind: pipeline # 定义对象类型,还有secret和signature两种类型 | |||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型 | |||
name: report-cli-pipeline # 定义流水线名称 | |||
#声明挂载卷 | |||
volumes: | |||
- name: cache #挂载卷名称 | |||
host: | |||
path: /root/cache #挂载卷挂载到主机的目录 | |||
steps: | |||
- name: restore-cache #步骤名称,读取缓存 | |||
image: drillster/drone-volume-cache #使用的镜像 | |||
settings: | |||
restore: true #restore: true会将文件从主机复制到容器 | |||
mount: #需要缓存的文件夹 | |||
- ./.npm-cache | |||
- ./node_modules | |||
volumes: #使用的缓存和容器内挂载目录 | |||
- name: cache #使用的缓存名称,和上面对应 | |||
path: /cache #把主机命为cache的缓存挂载到/cache下面在容器内挂载的目录 | |||
- name: install | |||
pull: if-not-exists # 如果镜像不存在则拉取,免去每次都要重新下载 | |||
image: node:alpine | |||
commands: | |||
- npm config set cache ./.npm-cache --global #设置npm缓存 | |||
- npm install | |||
- name: build | |||
pull: if-not-exists # 如果镜像不存在则拉取,免去每次都要重新下载 | |||
image: jarmour/vue-cli:latest | |||
commands: | |||
- npm run build:h5 | |||
- name: rebuild-cache #步骤名称,构建缓存 | |||
image: drillster/drone-volume-cache | |||
settings: | |||
rebuild: true #把容器内容复制到主机 | |||
mount: #先加载缓存 | |||
- ./.npm-cache | |||
- ./node_modules | |||
volumes: #再复制到主机 | |||
- name: cache | |||
path: /cache | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||