machine:
  services:
    - docker

dependencies:
  override:
    - docker build -t craftship/phonebox:$CIRCLE_SHA1 .

test:
  override:
    - docker run -d -p 80:8080 craftship/phonebox:$CIRCLE_SHA1; sleep 3
    - curl --retry 3 --retry-delay 1 -v http://localhost

deployment:
  hub:
    branch: master
    commands:
      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASSWORD
      - docker push craftship/phonebox:$CIRCLE_SHA1

machine:
  environment:
    TAG: ${CIRCLE_SHA1:0:7}
  services:
    - docker

dependencies:
  override:
    - docker build -t craftship/phonebox:$TAG .

test:
  override:
    - docker run -d -p 80:8080 craftship/phonebox:$TAG; sleep 3
    - curl --retry 3 --retry-delay 1 -v http://localhost

deployment:
  hub:
    branch: master
    commands:
      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASSWORD
      - docker push craftship/phonebox:$TAG

Improve tag for docker, keeping it DRY
Improve tag for docker, keeping it DRY

Make SHA1 shorter to give a friendlier name.
