Browse code

Add upstream-like Dockerfile for generating api docs

Add Makefile target:
make api

https://github.com/openshift/kubernetes/commit/0a05574463f5084ec43d39392333f051a26d68b4

Vojtech Vitek (V-Teq) authored on 2014/09/12 08:03:50
Showing 4 changed files
... ...
@@ -7,6 +7,7 @@
7 7
 #   test: Run tests.
8 8
 #   run: Run All-in-one server
9 9
 #   clean: Clean up.
10
+#   api: Generate new api docs.
10 11
 
11 12
 OUT_DIR = _output
12 13
 OUT_PKG_DIR = Godeps/_workspace/pkg
... ...
@@ -61,3 +62,10 @@ clean:
61 61
 	rm -rf $(OUT_DIR) $(OUT_PKG_DIR)
62 62
 .PHONY: clean
63 63
 
64
+# Generate api docs from .raml to .html.
65
+#
66
+# Example:
67
+#   make api
68
+api:
69
+	hack/build-api-docs-image.sh
70
+.PHONY: api
64 71
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+FROM google/nodejs
1
+RUN npm i -g raml2html
2
+ADD . /data
3
+CMD ["-i", "/data/oov3.raml", "-o", "/data/oov3.html"]
4
+ENTRYPOINT ["raml2html"]
... ...
@@ -6,8 +6,13 @@ Use htmlpreview for github with a URL like:
6 6
 [https://rawgit.com/openshift/origin/master/api/oov3.html] (https://rawgit.com/openshift/origin/master/api/oov3.html)
7 7
 
8 8
 ## Generating the API document
9
-Use [raml2html](https://www.npmjs.org/package/raml2html):
10 9
 ```
11
-$ raml2html -i oov3.raml -o oov3.html
10
+make api
12 11
 ```
12
+
13
+or:
14
+```
15
+hack/build-api-docs-image.sh
16
+```
17
+
13 18
 For additional documentation on raml go to [http://raml.org/](http://raml.org/)
14 19
new file mode 100755
... ...
@@ -0,0 +1,13 @@
0
+#!/bin/bash
1
+
2
+set -o errexit
3
+set -o nounset
4
+set -o pipefail
5
+
6
+hackdir=$(CDPATH="" cd $(dirname $0); pwd)
7
+
8
+cd $hackdir/../api && docker build -t kubernetes/raml2html .
9
+docker rm oov3docgen &>/dev/null || :
10
+docker run --name=oov3docgen kubernetes/raml2html
11
+docker cp oov3docgen:/data/oov3.html $hackdir/../api/
12
+docker rm oov3docgen &>/dev/null || :