stages:
  - build

before_script:
  - apk update
  - apk add nodejs npm
  - apk add yarn
  - apk add curl
  - export TAG=${CI_COMMIT_TAG:-latest}

build:
  stage: build
  services:
    - docker:18.09.6-dind
  parallel:
    matrix:
      - VERSION: [code, kube]
  script:
    - ./build.sh $TAG $VERSION $CI_REGISTRY_IMAGE
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.e-biz.fr
    - docker push $CI_REGISTRY_IMAGE/$VERSION:$TAG
  only:
    - master
    - tags