The following steps will help you successfully deploy from Codeship to Dokku. This will not take long to implement. You only need the public ssh key from your Codeship project and the bash script below.
Save the public key of the Codeship project. It is found in Project Settings > General Settings.
In project repo create a folder labeled tmp, then save the ssh key as codeship_projectname.pub.
Make sure when pasting, all the contents are in a single line and not multiple lines.
Add the public key to your dokku server using the following command in console.
cat tmp/codeship_projectname.pub | ssh [email protected] "sudo sshcommand acl-add dokku codeship_projectname"
- In Codeship, go to Project Settings > Deployment. Configure your deployment pipeline.
- Add a new custom script.
- Add the following lines to the custom script.
#!/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 [email protected]:projectname git push dokku master
Now every time you build on Codeship, it should deploy to your Dokku server.
Subscribe to Seth Austin Bergman
Get the latest posts delivered right to your inbox