image: docker:latest

services:
  - docker:dind

stages:
  - build

.build_template: &build_definition
  stage: build
  script:
    - OS="${CI_JOB_NAME#*:}"
    - apk add make

    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - make REGISTRY=${CI_REGISTRY_IMAGE} ${OS} 
    - make REGISTRY=${CI_REGISTRY_IMAGE} push${OS}
  artifacts:
    expire_in: 1 week
    paths:
      - dist/

amd64:amzn1:
  <<: *build_definition

amd64:amzn2:
  <<: *build_definition

amd64:centos7:
  <<: *build_definition

amd64:opensuse-leap15.1:
  <<: *build_definition

amd64:debian9:
  <<: *build_definition

amd64:debian10:
  <<: *build_definition

amd64:ubuntu16.04:
  <<: *build_definition

amd64:ubuntu18.04:
  <<: *build_definition
