stages:
  - clean
  - build
  - restart

clean-blockchain-data:
  stage: clean
  tags:
    - FairCoin.Co
  only:
    refs:
      - master
    variables:
      - $CMD =~ /clean/
  script:
    - docker-compose down
  after_script:
    - echo ${CI_PROJECT_DIR} > ~/test.txt
    - rm -R ~/.faircoin2

build-faircoind:
  stage: build
  tags:
    - FairCoin.Co
  only:
    refs:
      - master
    variables:
      - $CMD =~ /build/
  before_script:
    - mkdir -p ~/.faircoin2
  script:
    - docker-compose down
    - docker-compose build

restart-faircoind:
  stage: restart
  tags:
    - FairCoin.Co
  only:
    refs:
      - master
    variables:
      - $CMD =~ /build|restart/
  script:
    - docker-compose down
    - docker-compose up -d