image: docker:23.0.3

stages:
  - build


build_image:
  stage: build
  image: docker:23.0.3
  services:
    - 'docker:23.0.3-dind'
  before_script:
    - until docker info; do sleep 1; done
  script:
    - if [ "$CI_COMMIT_REF_NAME" == "master" ]; then TAG="latest"; else TAG="develop"; fi
    - docker build -t $CI_REGISTRY_IMAGE:$TAG -o type=docker .
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker push $CI_REGISTRY_IMAGE:$TAG


