Use pure go markdown processor to generate man files
Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
This commit is contained in:
parent
7e12911f62
commit
3f136dc0e0
4 changed files with 26 additions and 19 deletions
|
@ -42,7 +42,6 @@ RUN apt-get update && apt-get install -y \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
lxc=1.0* \
|
lxc=1.0* \
|
||||||
mercurial \
|
mercurial \
|
||||||
pandoc \
|
|
||||||
parallel \
|
parallel \
|
||||||
reprepro \
|
reprepro \
|
||||||
ruby1.9.1 \
|
ruby1.9.1 \
|
||||||
|
@ -63,6 +62,7 @@ RUN cd /usr/local/lvm2 && ./configure --enable-static_link && make device-mapper
|
||||||
RUN curl -sSL https://golang.org/dl/go1.3.src.tar.gz | tar -v -C /usr/local -xz
|
RUN curl -sSL https://golang.org/dl/go1.3.src.tar.gz | tar -v -C /usr/local -xz
|
||||||
ENV PATH /usr/local/go/bin:$PATH
|
ENV PATH /usr/local/go/bin:$PATH
|
||||||
ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
|
ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
|
||||||
|
ENV PATH /go/bin:$PATH
|
||||||
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
|
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
|
||||||
|
|
||||||
# Compile Go for cross compilation
|
# Compile Go for cross compilation
|
||||||
|
@ -80,6 +80,12 @@ RUN go get code.google.com/p/go.tools/cmd/cover
|
||||||
# TODO replace FPM with some very minimal debhelper stuff
|
# TODO replace FPM with some very minimal debhelper stuff
|
||||||
RUN gem install --no-rdoc --no-ri fpm --version 1.0.2
|
RUN gem install --no-rdoc --no-ri fpm --version 1.0.2
|
||||||
|
|
||||||
|
# Install man page generator
|
||||||
|
RUN mkdir -p /go/src/github.com/cpuguy83 \
|
||||||
|
&& git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
|
||||||
|
&& cd /go/src/github.com/cpuguy83/go-md2man \
|
||||||
|
&& go get -v ./...
|
||||||
|
|
||||||
# Get the "busybox" image source so we can build locally instead of pulling
|
# Get the "busybox" image source so we can build locally instead of pulling
|
||||||
RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
|
RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
FROM fedora:20
|
FROM golang:1.3
|
||||||
MAINTAINER ipbabble <emailwhenry@redhat.com>
|
RUN mkdir -p /go/src/github.com/cpuguy83
|
||||||
# Update and install pandoc
|
RUN mkdir -p /go/src/github.com/cpuguy83 \
|
||||||
RUN yum -y update; yum clean all;
|
&& git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
|
||||||
RUN yum -y install pandoc;
|
&& cd /go/src/github.com/cpuguy83/go-md2man \
|
||||||
|
&& go get -v ./...
|
||||||
|
CMD ["/go/bin/go-md2man", "--help"]
|
||||||
|
|
|
@ -44,27 +44,26 @@ Markdown (*.md) files.
|
||||||
|
|
||||||
# Generating man pages from the Markdown files
|
# Generating man pages from the Markdown files
|
||||||
|
|
||||||
The recommended approach for generating the man pages is via a Docker
|
The recommended approach for generating the man pages is via a Docker
|
||||||
container. Using the supplied Dockerfile, Docker will create a Fedora based
|
container using the supplied `Dockerfile` to create an image with the correct
|
||||||
container and isolate the Pandoc installation. This is a seamless process,
|
environment. This uses `go-md2man`, a pure Go Markdown to man page generator.
|
||||||
saving you from dealing with Pandoc and dependencies on your own computer.
|
|
||||||
|
|
||||||
## Building the Fedora / Pandoc image
|
## Building the md2man image
|
||||||
|
|
||||||
There is a Dockerfile provided in the `docker/docs/man` directory.
|
There is a `Dockerfile` provided in the `docker/docs/man` directory.
|
||||||
|
|
||||||
Using this Dockerfile, create a Docker image tagged `fedora/pandoc`:
|
Using this `Dockerfile`, create a Docker image tagged `docker/md2man`:
|
||||||
|
|
||||||
docker build -t fedora/pandoc .
|
docker build -t docker/md2man .
|
||||||
|
|
||||||
## Utilizing the Fedora / Pandoc image
|
## Utilizing the image
|
||||||
|
|
||||||
Once the image is built, run a container using the image with *volumes*:
|
Once the image is built, run a container using the image with *volumes*:
|
||||||
|
|
||||||
docker run -v /<path-to-git-dir>/docker/docs/man:/pandoc:rw \
|
docker run -v /<path-to-git-dir>/docker/docs/man:/docs:rw \
|
||||||
-w /pandoc -i fedora/pandoc /pandoc/md2man-all.sh
|
-w /docs -i docker/md2man /docs/md2man-all.sh
|
||||||
|
|
||||||
The Pandoc Docker container will process the Markdown files and generate
|
The `md2man` Docker container will process the Markdown files and generate
|
||||||
the man pages inside the `docker/docs/man/man1` directory using
|
the man pages inside the `docker/docs/man/man1` directory using
|
||||||
Docker volumes. For more information on Docker volumes see the man page for
|
Docker volumes. For more information on Docker volumes see the man page for
|
||||||
`docker run` and also look at the article [Sharing Directories via Volumes]
|
`docker run` and also look at the article [Sharing Directories via Volumes]
|
||||||
|
|
|
@ -18,5 +18,5 @@ for FILE in *.md; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
mkdir -p "./man${num}"
|
mkdir -p "./man${num}"
|
||||||
pandoc -s -t man "$FILE" -o "./man${num}/${name}"
|
go-md2man -in "$FILE" -out "./man${num}/${name}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue