I followed the following steps to successfully deploy from codeship to dokku.
- Save the public key of the codeship project. It is found in Project Settings > General Settings.
- Copy the public key to a file /tmp/codeship_projectname.pub.
- Make sure when pasting, all the contents are in a single line and not multiple lines.
- Add the public key to dokku using the following command in console. Reference.
cat /tmp/codeship_projectname.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
Where [description] is a single word used to identify the key. I use codeship_projectname for [description]
- In codeship, go to Project Settings > Deployment. Add a new custom script. Add the following lines to custom script. The git tree needs to be unshallowed first. Reference.
#!/bin/sh
git fetch --unshallow || true
git fetch origin "+refs/heads/*:refs/remotes/origin/*"
# checkout a remote branch with
# git checkout -b test origin/test
git remote add dokku dokku@yourdokkuinstance:projectname
git push dokku master
Now everytime you build on codeship, it should deploy to the dokku instance.