Last active
August 29, 2015 14:26
-
-
Save 0atman/d0c75648064092f8cc43 to your computer and use it in GitHub Desktop.
deploys a docker-compose project using docker-machine to digital ocean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -exec rm -rf {} \; || true | |
git clone git@github.com:${GITHUB_USERNAME}/${GITHUB_PROJECT}.git . | |
git checkout ${GIT_BRANCH} | |
docker-machine rm ${GITHUB_PROJECT}-${GIT_BRANCH} || true # while testing | |
docker-machine create ${GITHUB_PROJECT}-${GIT_BRANCH} --driver digitalocean --digitalocean-access-token TOKEN | |
eval "$(docker-machine env ${GITHUB_PROJECT}-${GIT_BRANCH})" | |
docker-compose -f docker-compose-machine.yml up -d | |
docker-compose -f docker-compose-machine.yml logs | |
MACHINE_IP=`docker-machine ip ${GITHUB_PROJECT}-${GIT_BRANCH}` | |
curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer TOKEN' -d "{\"type\":\"A\",\"name\":\"${GITHUB_PROJECT}-${GIT_BRANCH}\",\"data\":\"${MACHINE_IP}\",\"priority\":null,\"port\":null,\"weight\":null}" "https://api.digitalocean.com/v2/domains/YOURDOMAIN/records" | |
echo "Machine up at http://${GITHUB_PROJECT}-${GIT_BRANCH}.YOURDOMAIN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shell parameters are for use in jenkins'
parametrised builds