编程语言/Drone/示例:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 标题文本 == <syntaxhighlight lang="yaml"> kind: pipeline name: example-service trigger: branch: - master steps: - name: npm-auth image: robertstettner/drone-npm-auth settings: username: username password: password email: username@iftech.io registry: https://npm.yourcompany.com scope: '@jike' - name: install image: node:10 commands: - npm ci - name: lint image: node:10 commands:…”
 
Kangkk​(留言 | 贡献)
第66行: 第66行:
     ports:
     ports:
       - 27017</syntaxhighlight>
       - 27017</syntaxhighlight>
<syntaxhighlight lang="yaml">
kind: pipeline # 定义一个管道
type: docker # 当前管道的类型
name: test # 当前管道的名称
volumes: # 声明数据卷(此为服务器中的实际目录)
  - name: node_modules # 数据卷名称
    host: # Host Volume
      path: /volumes/drone/volumes/blog/node_modules # 宿主机目录    #绝对路径
  - name: deploy_path
    host:
      path: /workspace/blog
clone:
  disable: false # 启用代码拉取
steps: # 定义管道的执行步骤
  - name: deploy # 步骤名称
    image: node:16.13.2 # 当前步骤使用的镜像
    depends_on: [clone] # 依赖的步骤
    volumes: # 挂载数据卷(此为容器内的目录)
      - name: node_modules # 数据卷名称
        path: /drone/src/node_modules # 容器内目录 绝对路径
      - name: deploy_path
        path: /drone/src/html
    commands: # 当前步骤执行的命令
      - pwd # 查看当前目录
      - npm config set registry https://registry.npm.taobao.org # 切换淘宝镜像
      - npm install # 安装node_modules包
      - npm run build # 执行编译
      # - rm -fr ./blog
      - ls /drone/src
      - cp -r ./public/* ./html</syntaxhighlight>