A docker image to encapsulate mkdocs tool without you having to install mkdocs locally
- Docker: Install docker and have it running in your working environment
- Clone this repository
- Ensure you already have the mkdocs project/folder ready and obtain the path.
- Open up a terminal/shell environment and navigate to the directory of this repositiory
- Build the image with the command
docker build -t <image name> . - Edit the
produce.shscript, supply values for the variablescontainer_mount_root,container_name,mkdocs_project_dir, andimage_namewith the desired path to mount container to mkdocs folder, name of the docker container, mkdocs project directory path in your filesystem, and the docker image name respectively. Example is as below:
$ #variables
container_mount_root='/MkDocs_tool'
container_name='mkdocs-project'
mkdocs_project_dir='/Users/me/Documents/my-project'
image_name=mkdocs- Save and execute the below command from the terminal to build/produce the website:
$ bash produce.shThis command will first remove the docker container previously created, build the website and send a compressed project.tar.gz file containing a mkdocs generated site to the stdout.
- Edit the
server.shscript and replace<image name>with the name of the docker image already built - Execute the below command to serve the website:
$ bash serve.shThe above script mounts the repository directory to the container mount point /MkDocs_tool/my-site, extracts the compressed tar.gz file produced from the produce command step above, and use mkdocs to internally serve the website on port 8000.
Browse to http://localhost:8000 to view the website.
There is a Jenkinsfile at the repository root that executes both the Build step and Test step to serve the site.