platform: 10.11.92.34

clone:
  git:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-git:1.0
    pull: true
    dns: 223.5.5.5

pipeline:
  ## 读缓存
  read-cache:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-cache:1.0
    restore: true
    check: yarn.lock
    mount:
      - ./node_modules
    volumes:
      - /data/cache:/cache
    when:
      branch: 
        - dev
  ## 构建
  build:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-node:12.18.0-stretch
    dns: 114.114.114.114
    volumes:
      - /data/cache/yarn:/usr/local/share/.cache/yarn
    commands:
      - yarn
      - yarn build
    when:
      branch: 
        - dev

  store-cache:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-cache:1.0
    rebuild: true
    check: yarn.lock
    mount:
      - ./node_modules
    volumes:
      - /data/cache:/cache
    when:
      branch: 
        - dev
    
  ## 编译成静态文件
  docker:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5
    repo: gzgajzapi/apaas-ui
    version: v3.0.2
    channel: alpha
    registry: hub.wodcloud.com
    secrets:
      - source: REGISTRY_USER
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD
        target: REGISTRY_PASSWORD
    when: 
      branch: 
        - dev
  ## 更换dev生成镜像的名称
  harbor:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: hub.wodcloud.com/gzgajzapi/apaas-ui:v3.0.2-alpha
    target: hub.wodcloud.com/gzgajzapi/apaas-ui:v3.0.2
    registry: hub.wodcloud.com
    secrets:
      - source: REGISTRY_USER
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD
        target: REGISTRY_PASSWORD
    when: 
      branch: 
        - master
branches: [master,dev]
     