Contents Menu Expand Light mode Dark mode Auto light/dark mode
gessha.dev

Quick guide on publishing a simple static site with Dokku

The tutorial below assumes the following things:

# several variables to substitte for your own project
DIR_NAME=sample_site
PROJECT_NAME=sample_site
HOSTNAME=example.com
DOMAINNAME=example.com

# create a directory for the project and enter it
mkdir $DIR_NAME
cd DIR_NAME

# create a new Dokku app
ssh dokku@$HOSTNAME apps:create $PROJECT_NAME
# add the domain for it
ssh dokku@$HOSTNAME domains:add $PROJECT_NAME DOMAINNAME
# add SSL certificates for the site
ssh dokku@$HOSTNAME letsencrypt:enable $PROJECT_NAME

# initialize the git repo and add the dokku as a remote
git init
git remote add dokku dokku@$HOSTNAME:$PROJECT_NAME

# .static file tells Dokku that current project is a static site
# so copy it to the /www directory and serve it behind nginx
touch .static

# create sample content
touch index.html
git add .
git commit -m "initial commit"

# push the static site to the remote
git push dokku main

Now that you have the above done, you can use your favorite static site generator to generate static pages and serve them in from this repo.