Dokku is great. GitHub actions are great. Therefore, it only makes sense to combine these two amazing products to work together!
Deploying an app to Dokku as a part of your pipeline was never easier! Let’s see how we can have our apps deployed automatically to Dokku on certain events, in a few simple steps.
Note: At the time of writing, GitHub actions is still in beta. If you want to use it, you will need to sign up for the beta.
First step — add a workflow
.github/workflow directory inside your project root and create a
deploy.yml file in it. If you are new to GitHub actions, you may use the following example which deploys every time there’s a
push to the
You should change
app-name inputs to match your own Dokku app’s settings.
Do NOT change
ssh-private-key to contain your private key! More on that in the next section.
There are two extra inputs that are optional:
dokku-userin case your dokku configuration expect a user which is different than “dokku” for git deployments
remote-branchin case your dokku configuration deploys from branches different than “master”
Finally, commit the file but don’t push yet!
Second step — add a private key
Your ssh private key should always remain in secret and never tracked in your git repository. In order to add the private key safely, you should add it as a secret.
Open your repository on GitHub, and navigate to Settings > Secrets:
Click on “Add a new secret”, name it
SSH_PRIVATE_KEY and paste the contents of your private key in the value section.
If you’re not sure how to recognize your private key, it can be usually found in
~/.ssh/id_rsa file, and its content should be similar to:
-----BEGIN OPENSSH PRIVATE KEY----- . . . -----END OPENSSH PRIVATE KEY-----
Step 3 — Push the changes
Push the changes you’ve made in Step 1 to your GitHub repository and watch the deployment made automatically!
That’s it! Did you find a mistake? Please write me. Are you using my dokku-deploy-action? Please give it a ⭐️: https://github.com/marketplace/actions/dokku-deploy-action
Originally posted on Medium.