Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Dockerfile for building and previewing docs locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Dirac committed Aug 5, 2016
1 parent 4ed3f3b commit ac53ca2
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 14 deletions.
3 changes: 3 additions & 0 deletions docs/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
_build

43 changes: 43 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:14.04
MAINTAINER Mu Li <muli@cs.cmu.edu>

#
# First, build MXNet binaries (ref mxnet/docker/cpu/Dockerfile)
#

RUN apt-get update && apt-get install -y build-essential git libopenblas-dev libopencv-dev
RUN git clone --recursive https://github.com/dmlc/mxnet/ && cd mxnet && \
cp make/config.mk . && \
echo "USE_BLAS=openblas" >>config.mk && \
make -j$(nproc)

# python pakcage
RUN apt-get install -y python-numpy wget unzip
ENV PYTHONPATH /mxnet/python

#
# Now set up tools for doc build
#

RUN apt-get update && apt-get install -y \
doxygen \
build-essential \
git \
python-pip

RUN pip install sphinx==1.3.5 CommonMark==0.5.4 breathe mock==1.0.1 recommonmark

WORKDIR /opt/mxnet/docs

# Fool it into thinking it's on a READTHEDOCS server, so it builds the
# API reference
ENV READTHEDOCS true

ENTRYPOINT /opt/mxnet/docs/build-preview.sh

EXPOSE 8008

# Put this at the end so that you don't have to rebuild the earlier
# layers when iterating on the docs themselves.
ADD . /opt/mxnet/docs

14 changes: 0 additions & 14 deletions docs/README

This file was deleted.

50 changes: 50 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# MXNet documentation

A built version of document is available at http://mxnet.dmlc.ml

## To build docs with Docker

The `Dockerfile` in this directory encapsulates all the dependencies needed
to build the docs. The default entrypoint builds the docs and serves them
through a simple HTTP server for previewing.

```
docker build -t mxnet/docs .
docker run -it -p 8008:8008 mxnet/docs
open http://localhost:8008/
```

### Faster iterative development

If you are working on the docs and want to rebuild them without creating a new
docker image each time, you can do this with

```
docker run -it -p 8008:8008 -v `pwd`:/opt/mxnet/docs mxnet/docs
```

which maps your current directory into the docker image to get any local
changes.

**NOTE:** Any changes to the API reference will not get rebuilt this way.
The API reference docs are introspected from the built binaries, which
in this Dockerfile are pulled from github/dmlc/master. To work-around
this, map a volume with your code changes into the container, and rebuild
MXNet in the container before doing the doc build. Or use the local
build described below.

## Local build

To build the documentation without docker on your local machine, first
install the required packages for Ubutun 14.04. These are approximately:

```
sudo apt-get install doxygen python-pip
sudo pip install sphinx==1.3.5 CommonMark==0.5.4 breathe mock==1.0.1 recommonmark
```

(Refer to the Dockerfile for a more reliable description of the dependencies.)
Once the MXNet binaries are built, and you have the dependencies installed,
you can build the docs with:

```make html```
14 changes: 14 additions & 0 deletions docs/build-preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Script to build the HTML docs and serve them.
# Run within docker container for best results.

echo "Building MXNet documentation..."
make clean
make html
echo "Done building MXNet documentation..."

echo "Serving MXNet docs on port 8008..."
cd _build/html
python -m SimpleHTTPServer 8008

0 comments on commit ac53ca2

Please sign in to comment.