stages:
  - build
  - deploy

before_script:
  - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY

build-docker-image:
  stage: build
  script:
    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
    - docker push "$CI_REGISTRY_IMAGE"
  only:
    - master
    - chat

update-docker-image:
  stage: deploy
  tags:
    - ansible-update
  variables:
    GIT_STRATEGY: none
  script:
    - docker pull "$CI_REGISTRY_IMAGE"
  only:
    - master
    - chat
