machine:
  services:
    - docker

dependencies:
  override:
    - docker build -t test-integration-nodejs:latest .
    - >
      docker run
      -e "APIKEY=${APIKEY}"
      -e "CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME}"
      -e "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}"
      -e "IMAGE=${IMAGE:-coreos-beta}"
      --name=test-integration-nodejs-init test-integration-nodejs:latest /initialize.sh
    - docker commit test-integration-nodejs-init test-integration-nodejs:latest

test:
  override:
    - docker run --name=test-integration-nodejs-hello-world test-integration-nodejs:latest /run_hello_world_test.sh
    - docker run --name=test-integration-nodejs-apt-packages test-integration-nodejs:latest /run_apt_packages_test.sh
    - docker run --name=test-integration-nodejs-apt-packages test-integration-nodejs:latest /run_restart_test.sh
  post:
    - docker run --name=DUMP-test-integration-nodejs test-integration-nodejs:latest vagrant ssh -- sudo journalctl
    - docker run --name=DESTROY-test-integration-nodejs test-integration-nodejs:latest vagrant destroy -f
    # TODO: Collect container as an asset?


machine:
  services:
    - docker

dependencies:
  override:
    - docker build -t test-integration-nodejs:latest .
    - >
      docker run
      -e "APIKEY=${APIKEY}"
      -e "CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME}"
      -e "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}"
      -e "IMAGE=${IMAGE:-coreos-beta}"
      --name=test-integration-nodejs-init test-integration-nodejs:latest /initialize.sh
    - docker commit test-integration-nodejs-init test-integration-nodejs:latest

test:
  override:
    - docker run --name=test-integration-nodejs-hello-world test-integration-nodejs:latest /run_hello_world_test.sh
    - docker run --name=test-integration-nodejs-apt-packages test-integration-nodejs:latest /run_apt_packages_test.sh
    - docker run --name=test-integration-nodejs-apt-packages test-integration-nodejs:latest /run_restart_test.sh
  post:
    - docker run --name=DUMP-test-integration-nodejs test-integration-nodejs:latest vagrant ssh -- sudo journalctl
    - docker run --name=DESTROY-test-integration-nodejs test-integration-nodejs:latest vagrant destroy -f
    - curl -l -X DELETE -H 'Content-Type: application/json' -H 'Authorization: Bearer ${APIKEY}' https://api.digitalocean.com/v2/account/keys/$(ssh-keygen -l -f /.ssh/id_rsa | awk '{ print $2 }')
    # TODO: Collect container as an asset?


Remove unused ssh-key from digital ocean.
Remove unused ssh-key from digital ocean.
