summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSofia Wallin <sofia.wallin@ericsson.com>2018-03-27 18:06:23 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-27 18:06:23 +0000
commit038e308c8f868fe123ef2f83ed6e7a7f570512e3 (patch)
treef4a93879e2dfac6283a261e0b24adacba76945a5
parentc7c7a2c260d221a5d9a7c309e2881f6a5268fd95 (diff)
parent658778cd891d9327a1ce91e6bcbc8fcfd81e7cd6 (diff)
Merge "Add opnfvdocs build container"
-rw-r--r--docker/Dockerfile23
-rw-r--r--docker/README.md28
-rw-r--r--docker/entrypoint.sh28
3 files changed, 79 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 000000000..fe1ff808a
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,23 @@
+FROM ubuntu:14.04
+
+MAINTAINER Julien Zhang <julienjut@gmail.com>
+LABEL version="0.1" Description="OPNFVDocs Docker container"
+
+ARG BRANCH=master
+ARG build=html
+ENV BRANCH=$BRANCH
+ENV build=$build
+
+# Dependencies for sphinx, pip and git
+RUN apt-get update && apt-get install -y \
+ python-pip python-sphinx git
+
+RUN git clone --depth=1 --branch=$BRANCH https://git.opnfv.org/opnfvdocs /opnfvdocs
+RUN pip install -r /opnfvdocs/etc/requirements.txt
+RUN pip install virtualenv
+RUN rm -rf /var/lib/apt-lists/* /root/.cache/pip /opnfvdocs/.git
+
+ADD ./entrypoint.sh /sbin/entrypoint.sh
+RUN chmod 755 /sbin/entrypoint.sh
+
+ENTRYPOINT /sbin/entrypoint.sh
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 000000000..c7b119c1b
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,28 @@
+# OPNFVDoc tool readme
+------------------------
+
+This docker container is used for building OPNFV docs from **rst** format files for each feature
+project. The output is just like contents in [opnfvdocs](http://docs.opnfv.org/) website. You can
+review the contents through web browser. Currently *PDF* output is not good enough and it will make
+the container image size 3x larger. PDF output format is not supported in this release.
+
+# Usage
+
+* The default build is *html*, you can run:
+```
+docker run -it --rm -v ./some-opnfv-repo:/docs -v /tmp/output:/output \
+ opnfv/opnfvdocs
+```
+
+* Then if you want to build epub, etc you could pass it as an arg:
+```
+docker run -it --rm -v ./some-opnfv-repo:/docs -v /tmp/output:/output \
+ -e build=epub opnfv/opnfvdocs
+```
+
+## env parameters
+* build: [html | singlehtml | epub]
+
+## two directory parameters
+* /docs: **mandatory**, used for source files
+* /output: **optional**, used for storing the built result
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
new file mode 100644
index 000000000..6982bffa2
--- /dev/null
+++ b/docker/entrypoint.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -x
+
+if [ ! -d /docs ]; then
+ echo source path /docs not exist and no repo for building
+ exit 1
+fi
+
+cd /docs
+for item in conf.py _templates _static
+do
+ cp -r /opnfvdocs/docs/$item ./
+done
+
+# use the same procedure as verify Job
+# [TODO]create a common macro can be consumed in Docker and Jenkins
+sudo pip install virtualenv
+virtualenv $WORKSPACE/venv
+. $WORKSPACE/venv/bin/activate
+pip install --upgrade pip
+pip freeze
+pip install tox
+tox -edocs
+
+# copy the building result to host
+if [ -d /output ]; then
+ cp -R ./docs/_build /output
+fi
+