image: docker:git

services:
  - docker:dind

variables:
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""

stages:
  - build
  - deploy

build_master:
  stage: build
  tags:
    - build-push-to-registry
  only:
    - master
  script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
    - docker build -t registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/self-data-technical-doc .
    - docker push registry.forge.grandlyon.com/web-et-numerique/factory/llle_project/self-data-technical-doc

deploy_master:
  stage: deploy
  tags:
    - deploy-alpha
  only:
    - master
  script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
    - docker-compose pull
    - docker-compose up -d self_data_docs
