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
    mount:
      - ./node_modules
    volumes:
      - /data/cache:/cache
    when:
      branch: 
        - pure
  ## 构建
  build:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-node:12.18.0-stretch
    dns: 223.5.5.5
    volumes:
      - /data/cache/yarn:/usr/local/share/.cache/yarn
    commands:
      - yarn
      - yarn build
    when:
      branch: 
        - pure

  store-cache:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-cache:1.0
    rebuild: true
    mount:
      - ./node_modules
    volumes:
      - /data/cache:/cache
    when:
      branch: 
        - pure
    
  ## 编译成静态文件
  docker:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: pure
    args: "TARGETOS=linux,TARGETARCH=amd64" ## 不同架构的构建参数
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - pure
  
  # 构建arm64位镜像
  docker-arm64:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-arm64
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: pure-arm64
    args: "TARGETOS=linux,TARGETARCH=arm64"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - pure
  
  docker-ppc64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-ppc64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: pure-ppc64le
    args: "TARGETOS=linux,TARGETARCH=ppc64le"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - pure

  docker-mips64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-mips64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: pure-mips64le
    args: "TARGETOS=linux,TARGETARCH=mips64le"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - pure
