A few things need to happen for this to work properly. First, add a
deployment section to circle.yml:
main: # or whatever your deployment is called
branch: master # or whatever branch you want to deploy
- docker login -e (your email here) -u (your username here) -p (your password here)
- docker push pgeiss/appname
Thanks to this blog post for the following script. Then, make a file called start.sh in the top level of your repository (if you use a different name, change the circle.yml's last line) that contains the following:
echo "stopping running application"
ssh $DEPLOY_USER@$DEPLOY_HOST 'docker stop dodsv'
ssh $DEPLOY_USER@$DEPLOY_HOST 'docker rm dodsv'
echo "pulling latest version of the code"
ssh $DEPLOY_USER@$DEPLOY_HOST 'docker pull pgeiss/appname-webapp:latest'
echo "starting the new version"
ssh $DEPLOY_USER@$DEPLOY_HOST 'docker run -d --restart=always --name dodsv -p 80:5432 pgeiss/appname:latest'
Finally, to allow the script to work you'll need to set the script to be executable with
chmod and add the environment variables and your
DEPLOY_USER's ssh key (preferably) or credentials (if no ssh key) to CircleCI. After doing that CircleCI should deploy your app after a successful build.