stages:
  - build
  - start
  - stop
  - uninstall
  - remove

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

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

stop-faircoind:
  stage: stop
  tags:
    - FairCoin.Co
  only:
    refs:
      - master
    variables:
      - $CMD =~ /stop/
  script:
    - docker-compose stop

uninstall-faircoind:
  stage: uninstall
  tags:
    - FairCoin.Co
  only:
    refs:
      - master
    variables:
      - $CMD =~ /uninstall/
  script:
    - docker-compose down

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