Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Simple bash script that uses Docker to build a test container, run tests inside the container, tag successful builds, and clean up after itself.
#!/bin/bash
sudo docker build -t $JOB_NAME/$BUILD_NUMBER .
DB_NAME="/$JOB_NAME-$BUILD_NUMBER-db"
DB_CONTAINER=$(sudo docker run -d -name $DB_NAME <private repository URL>/database-schema)
sudo docker run -link $DB_NAME:db -t $JOB_NAME/$BUILD_NUMBER nosetests
sudo docker tag $JOB_NAME/$BUILD_NUMBER <private repository URL>/${JOB_NAME}-master
sudo docker push <private repository URL>/${JOB_NAME}-master >/dev/null
sudo docker kill ...
sudo docker rm ...
sudo docker rmi ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment