machine:
  services:
    - docker

dependencies:
  pre:
    - docker pull openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x || true
  override:
    - docker build -f Dockerfile-prereqs -t openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x .
    - docker build -f Dockerfile-machine -t openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x .

test:
  override:
    # Postgres needs a little time
    - docker-compose up -d && sleep 15
    - docker-compose run machine python3 /usr/local/src/openaddr/test.py

deployment:
  hub:
    branch: [6.x]
    commands:
      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
      - docker tag openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x openaddr/prereqs:`cat openaddr/VERSION`
      - docker tag openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x openaddr/machine:`cat openaddr/VERSION`
      - docker push openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x
      - docker push openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x
      - docker push openaddr/prereqs:`cat openaddr/VERSION`
      - docker push openaddr/machine:`cat openaddr/VERSION`

machine:
  services:
    - docker

dependencies:
  pre:
    - docker pull openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x || true
  override:
    - docker build -f Dockerfile-prereqs -t openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x .
    - docker build -f Dockerfile-machine -t openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x .

test:
  override:
    # Postgres needs a little time
    - docker-compose up -d && sleep 15
    - docker-compose run machine python3 /usr/local/src/openaddr/test.py

deployment:
  hub:
    branch: [6.x]
    commands:
      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
      - docker tag openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x openaddr/prereqs:`cat openaddr/VERSION`
      - docker tag openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x openaddr/machine:`cat openaddr/VERSION`
      - docker tag openaddr/prereqs:`cat openaddr/VERSION` openaddr/prereqs:latest
      - docker tag openaddr/machine:`cat openaddr/VERSION` openaddr/machine:latest
      - docker push openaddr/prereqs:`cut -f1 -d. openaddr/VERSION`.x
      - docker push openaddr/machine:`cut -f1 -d. openaddr/VERSION`.x
      - docker push openaddr/prereqs:`cat openaddr/VERSION`
      - docker push openaddr/machine:`cat openaddr/VERSION`
      - docker push openaddr/prereqs:latest
      - docker push openaddr/machine:latest

Tag and push the 'latest' tag for published images
Tag and push the 'latest' tag for published images
