Public | Automated Build

Last pushed: 9 days ago
Short Description
Short description is empty for this repo.
Full Description

juliocesar.io

This blog is build with hugo, which is a static site generator. See Hugo.

Building

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.

Deploy

Once you have the image build, you can run in a container with Docker run:

$ docker run --name blog -d -p 80:80

Verify that is up and running through the 80 port !!

Extra

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.
Ex:

http://IP:port/ping?token=12345

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 jsonify(success=True)


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 !

Docker Pull Command
Owner
uzi200
Source Repository