machine:
  pre:
    - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
  services:
    - docker
  python:
      version: 2.7.11

dependencies:
    pre:
        - pip install ansible
        - pip install invoke
        - pip install docker-compose
        - docker info


test:
    pre:
        - docker-compose build
    override:
        - docker-compose run backend bash -c "/tmp/wait-for-it.sh -h db -p 5432 && ./manage.py test"


deployment:
    hub:
        branch: master
        commands:
            - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
            - docker push banjocat/calorie_find
            - echo "---" > ./ansible/vars/docker_env.yml
            - ansible-playbook -i ./ansible/staging_inventory -u root --tags "deploy" --extra-vars="docker_user=$DOCKER_USER docker_password=$DOCKER_PASS docker_email=$DOCKER_EMAIL" ./ansible/playbook.yml


machine:
  pre:
    - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
  services:
    - docker
  python:
      version: 2.7.11

dependencies:
    pre:
        - pip install ansible
        - pip install docker-compose
        - docker info


test:
    pre:
        - docker-compose build
    override:
        - docker-compose run backend bash -c "/tmp/wait-for-it.sh -h db -p 5432 && ./manage.py test"


deployment:
    hub:
        branch: master
        commands:
            - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
            - docker push banjocat/calorie_find
            - echo "---" > ./ansible/vars/docker_env.yml
            - ansible-playbook -i ./ansible/staging_inventory -u root --tags "deploy" --extra-vars="docker_user=$DOCKER_USER docker_password=$DOCKER_PASS docker_email=$DOCKER_EMAIL" ./ansible/playbook.yml


Remove invoke - not needed
Remove invoke - not needed