Continuous Deployment with Codeship and Dokku
以下步骤将帮助您成功从 Codeship 部署到 Dokku。这不会花很长时间来实施。您只需要 Codeship 项目中的公共 ssh 密钥和下面的 bash 脚本。
保存 Codeship 项目的公钥。它位于项目设置 > 常规设置中。
在项目 repo 中创建一个标记为 tmp 的文件夹,然后将 ssh 密钥保存为 codeship_projectname.pub。
确保粘贴时所有内容都在一行而不是多行。
在控制台中使用以下命令将公钥添加到您的 dokku 服务器。
cat tmp/codeship_projectname.pub | ssh root@dokkuinstance.com "sudo sshcommand acl-add dokku codeship_projectname"
在 Codeship 中,转到项目设置 > 部署。配置您的部署管道。
添加新的自定义脚本。
将以下行添加到自定义脚本中。
#!/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@dokkuinstance.com:projectname
git push dokku master
现在,每次您在 Codeship 上构建时,它都应该部署到您的 Dokku 服务器。
Here's a tutorial on my blog. Hope this helps!