Deploy Jekyll Site With Dokku

Updated: 26 Mar 2024 Reading time: 1 minute

Jekyll is a static site generator written in Ruby. It enables you to create and maintain websites, particularly blogs, without the need for a backend or database. Jekyll takes your content, written in Markdown, Textile, HTML, or Liquid, and renders it into a static website ready to be served by a web server.

What you’ll need:

  1. A server (I use Hetzner)
  2. Installation and configuration of Dokku on the server
  3. Connecting a domain name to the server

Connect to your Remote Server

ssh remote_username@remote_host

For example:

ssh root@11.22.33.444

Create a Dokku Application

dokku apps:create coolblog

cd coolblog

Initialize a Git repository

git init

Create the .buildpacks file (if you are using VS Code)

code .buildpacks

Add these two lines to the file

https://github.com/heroku/heroku-buildpack-nginx.git
https://github.com/DanielZwijnenburg/dokku-buildpack-jekyll4-nginx.git

Add your Jekyll files to the repository and commit your changes

git add . && git commit -m "initial commit"

Add your Dokku server as a remote repository

git remote add dokku dokku@ip:name-of-your-repository

For example:

git remote add dokku dokku@11.22.33.444:coolblog

Push your cool blog to Dokku

git push dokku main

If you need to use environment variables, use this command

dokku config:set coolblog JEKYLL_ENV=production

Set the domain name

dokku domains:set coolblog coolblog.com

Visit http://coolblog.com and enjoy your awesome blog!

Back