variables:
    GIT_SUBMODULE_STRATEGY: recursive

stages:
    - build
    - push
    - clean
    - deploy

before_script:
    - docker --version
    - docker-compose --version

build:
    stage: build
    script:
        - make build

push:
    stage: push
    only:
        - master
    script:
        - make push

clean:
    stage: clean
    script:
        - make clean

deploy:
    stage: deploy
    script:
        - echo Deploying production on ${PROD_HOST}...
        - docker -H ${PROD_HOST} service update --force --detach --image=$(docker inspect --format='{{index .RepoDigests 0}}' ${REGISTRY}/icnml_web) ${PROD_SERVICE_NAME}
    only:
        - master