nginx + hugo + git in Docker
Go to file
2023-08-31 19:03:16 +02:00
aux Add support for SSH git URLs 2023-08-31 19:03:16 +02:00
init Add support for SSH git URLs 2023-08-31 19:03:16 +02:00
.gitattributes Force LF line endings in this repository 2023-08-28 23:50:00 +02:00
Dockerfile Add support for SSH git URLs 2023-08-31 19:03:16 +02:00
README.md Add support for SSH git URLs 2023-08-31 19:03:16 +02:00

blogker

A nginx-powered container hosting a hugo-built blog regularly pulled off git.

Run

Auto-Pull Git

If you store your blog data in a git repository, run the container with env REPO_URL set to a Git repo:

docker run -e REPO_URL=https://git.maride.cc/maride/sec.maride.cc.git -p 80:80 -d blogker

The repository will be pulled and built every 10 minutes.

SSH URLs

If you specify a SSH URL (ssh:// ...) for your repository, the host key will be automatically pulled and added as trusted host. Make sure to double-check those host keys with your git server - although a MITM scenario is unlikely and won't pose a big risk in the case of blogker. YMMV, but still, this may be a security risk in some cases.

If you want to pull private repositories, you may need to generate a SSH key for this purpose, and hand in the private key file, e.g. via -v ./id_rsa:/root/.ssh/id_rsa.

Passthrough via Bind

To just use a specific directory as the hugo blog contents, run the container with the repository passed through as bind directory:

docker run -v /var/myblog:/repo -p 80:80 -d blogker

The repository will be built every 10 minutes, but you need to implement a mechanism to update the blog repository on your own. This setup can be handy in a testing/dev environment where you don't want to have all your blog posts published right away.