Browse code

Use pure go markdown processor to generate man files

Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)

Brian Goff authored on 2014/08/05 09:59:37
Showing 4 changed files
... ...
@@ -42,7 +42,6 @@ RUN	apt-get update && apt-get install -y \
42 42
 	libsqlite3-dev \
43 43
 	lxc=1.0* \
44 44
 	mercurial \
45
-	pandoc \
46 45
 	parallel \
47 46
 	reprepro \
48 47
 	ruby1.9.1 \
... ...
@@ -63,6 +62,7 @@ RUN	cd /usr/local/lvm2 && ./configure --enable-static_link && make device-mapper
63 63
 RUN	curl -sSL https://golang.org/dl/go1.3.src.tar.gz | tar -v -C /usr/local -xz
64 64
 ENV	PATH	/usr/local/go/bin:$PATH
65 65
 ENV	GOPATH	/go:/go/src/github.com/docker/docker/vendor
66
+ENV PATH /go/bin:$PATH
66 67
 RUN	cd /usr/local/go/src && ./make.bash --no-clean 2>&1
67 68
 
68 69
 # Compile Go for cross compilation
... ...
@@ -80,6 +80,12 @@ RUN	go get code.google.com/p/go.tools/cmd/cover
80 80
 # TODO replace FPM with some very minimal debhelper stuff
81 81
 RUN	gem install --no-rdoc --no-ri fpm --version 1.0.2
82 82
 
83
+# Install man page generator
84
+RUN mkdir -p /go/src/github.com/cpuguy83 \
85
+    && git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
86
+    && cd /go/src/github.com/cpuguy83/go-md2man \
87
+    && go get -v ./...
88
+
83 89
 # Get the "busybox" image source so we can build locally instead of pulling
84 90
 RUN	git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
85 91
 
... ...
@@ -1,5 +1,7 @@
1
-FROM fedora:20
2
-MAINTAINER ipbabble <emailwhenry@redhat.com>
3
-# Update and install pandoc
4
-RUN yum -y update; yum clean all;
5
-RUN yum -y install pandoc;
1
+FROM golang:1.3
2
+RUN mkdir -p /go/src/github.com/cpuguy83
3
+RUN mkdir -p /go/src/github.com/cpuguy83 \
4
+    && git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
5
+    && cd /go/src/github.com/cpuguy83/go-md2man \
6
+    && go get -v ./...
7
+CMD ["/go/bin/go-md2man", "--help"]
... ...
@@ -44,27 +44,26 @@ Markdown (*.md) files.
44 44
 
45 45
 # Generating man pages from the Markdown files
46 46
 
47
-The recommended approach for generating the man pages is via a  Docker 
48
-container. Using the supplied Dockerfile, Docker will create a Fedora based 
49
-container and isolate the Pandoc installation. This is a seamless process, 
50
-saving you from dealing with Pandoc and dependencies on your own computer.
47
+The recommended approach for generating the man pages is via a Docker
48
+container using the supplied `Dockerfile` to create an image with the correct
49
+environment. This uses `go-md2man`, a pure Go Markdown to man page generator.
51 50
 
52
-## Building the Fedora / Pandoc image
51
+## Building the md2man image
53 52
 
54
-There is a Dockerfile provided in the `docker/docs/man` directory.
53
+There is a `Dockerfile` provided in the `docker/docs/man` directory.
55 54
 
56
-Using this Dockerfile, create a Docker image tagged `fedora/pandoc`:
55
+Using this `Dockerfile`, create a Docker image tagged `docker/md2man`:
57 56
 
58
-    docker build  -t fedora/pandoc .
57
+    docker build -t docker/md2man .
59 58
 
60
-## Utilizing the Fedora / Pandoc image
59
+## Utilizing the image
61 60
 
62 61
 Once the image is built, run a container using the image with *volumes*:
63 62
 
64
-    docker run -v /<path-to-git-dir>/docker/docs/man:/pandoc:rw \
65
-    -w /pandoc -i fedora/pandoc /pandoc/md2man-all.sh
63
+    docker run -v /<path-to-git-dir>/docker/docs/man:/docs:rw \
64
+    -w /docs -i docker/md2man /docs/md2man-all.sh
66 65
 
67
-The Pandoc Docker container will process the Markdown files and generate
66
+The `md2man` Docker container will process the Markdown files and generate
68 67
 the man pages inside the `docker/docs/man/man1` directory using
69 68
 Docker volumes. For more information on Docker volumes see the man page for
70 69
 `docker run` and also look at the article [Sharing Directories via Volumes]
... ...
@@ -18,5 +18,5 @@ for FILE in *.md; do
18 18
 		continue
19 19
 	fi
20 20
 	mkdir -p "./man${num}"
21
-	pandoc -s -t man "$FILE" -o "./man${num}/${name}"
21
+	go-md2man -in "$FILE" -out "./man${num}/${name}"
22 22
 done