> ## Content Index
> Fetch the complete content index at: https://blog.amosti.net/llms.txt
> Use this file to discover other available public pages before exploring further.

# Build and publish AsciiDoc with Docker and nginx
- URL: https://blog.amosti.net/build-and-publish-asciidoc-with-docker-and-nginx/
- Published: 2015-09-03T19:02:39.000Z
- Updated: 2015-09-03T19:04:43.000Z
- Author: Andreas Mosti
- Tags: #Import 2026-11-20 06:35

One of the teams at work is piloting the usage of [AsciiDoc](http://www.methods.co.nz/asciidoc/?ref=blog.amosti.net) for documentation of their product. AsciiDoc is a markup-format just like Gruber's [Markdown](http://daringfireball.net/projects/markdown/?ref=blog.amosti.net), but is more advanced and offers more possibilities. Since the documentation is located alongside the source code in Git (as it should be!) I created a simple build step for easy build and deploy of the documentation with my favorite tool, [Docker](https://www.docker.com/?ref=blog.amosti.net) with public images directly from the [Docker Hub](https://hub.docker.com/?ref=blog.amosti.net).

These steps gets triggered on each build:

```
if [[ -z "$(sudo docker ps | grep webserver)" ]]; then
    sudo docker run -dt --name webserver -p 80:80 -v /usr/share/nginx/html nginx
fi

sudo docker run -it -v /var/buildDropLocation/build/docs:/documents/ --volumes-from webserver asciidoctor/docker-asciidoctor asciidoctor -a stylesheet=dips.css -a toc-left technical_document.adoc -D /usr/share/nginx/html

```

In short, we check if the [nginx](http://nginx.org/?ref=blog.amosti.net)\-container is running and starts it if needed. The HTML-folder is exposed.  
Next we pull down and run the [asciidoctor-image](https://github.com/asciidoctor/docker-asciidoctor?ref=blog.amosti.net) from the Docker Hub and link in the docs-folder from the build. We use [TeamCity](https://www.jetbrains.com/teamcity/?ref=blog.amosti.net), so customize these variables to fit your build system. asciidoctor then runs on the files and puts the output HTML in the volume from the nginx-container. Easy as that, live documentation directly from the latest build.