This blog is build with hugo, which is a static site generator. See Hugo.
On Docker machine, run in the the root dir of this repo:
$ docker build -t blog .
Docker should setup all you need, dependencies, the hugo client and a the settings for the server in nginx.
Once you have the image build, you can run in a container with
$ docker run --name blog -d -p 80:80
Verify that is up and running through the
80 port !!
If you want to have a easy way to publish your content without dealing with devops stuff, you can now setup a webhook using github, and docker hub with an automated build repository.
a CI like environment
I'm using an app in Flask that's triggered a script every time docker hub detects a commit from github.
When the commit is made, docker hub build the image, when is finished the webhook make a
POST to the server.
You have to define an endpoint.
When is done, the server validate and run the script in
app/deploy.sh, if the token is correct then respond to the client in JSON format
if request.method == 'POST': token = request.args.get('token') if str(token) == str(os.environ.get('TOKEN')): subprocess.call("app/deploy.sh") return jsonify(success=True) return jsonify(success=False), 500
Here is my script look like:
#!/bin/bash docker pull uzi200/juliocesar.io docker stop blog docker rm blog docker run --name blog -d -p 80:80 uzi200/juliocesar.io
You can take a look to the repo for the webhook listener app here.
I hope this serve anyone who want a blog without a messy CMS's and complicated things just for blogging !