ASP.NET5CO documentation


The documentation of project ASP.NET5CO is built with a Docker image that uses the Skinny Bones Jekyll theme.

Installation

Follow these steps to setup a Jekyll environment for the documentation of the project.

Install Docker and start daemon

$ # For Fedora systems
$ sudo yum -y install docker-io
$ sudo systemctl start docker.service

Clone the ASP.NET5CO repository

$ git clone git@github.com:lopezpdvn/aspnet5co.git
$ cd aspnet5co

Run Jekyll container from Docker Hub inside the repository directory. The first time will take a few minutes since it will download the docker image and build it.

$ HOSTPORT=<host port number>
$ sudo docker run -t -i -v "$PWD:/src" -p $HOSTPORT:4000 --entrypoint=bash grahamc/jekyll
...
root@29bfc31d9ce3:/src# cd

Install all dependencies

root@29bfc31d9ce3:/src# bundle install

Get out of the container.

root@29bfc31d9ce3:/src# exit

Create a Docker image from the container using the container id shown in the container prompt, in this case is 29bfc31d9ce3 and we’re naming it lopezpdvn/aspnet5co-doc

$ sudo docker commit 29bfc31d9ce3 lopezpdvn/aspnet5co-doc0

Stop and remove original container used to create the image

$ sudo docker stop 29bfc31d9ce3
$ sudo docker rm 29bfc31d9ce3

Building and serving the documentation site

You’re done, to locally build and serve the documentation you need to do 2 things:

  1. Start a temporary container with the image created above
  2. Run the Make target servelocal

To start a temporary container you run the below commands

$ HOSTPORT=<host port number>
$ sudo docker run -t -i -v "$PWD:/src" -p $HOSTPORT:4000 --entrypoint=bash grahamc/jekyll
root@<temporary container id>:/src#

What I do is I create short script at bin/localserver which sets a few details of my host machine including the host port for the HTTP server and runs above command. Then I run such script with the Make target localserver

$ make localserver
root@<temporary container id>:/src#

Then inside the container you run the Make target servelocal

root@<temporary container id>:/src# make servelocal

The docker container will execute the Jekyll server and serve the contents on the selected host port.