summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Magnusson <peter@wselcon.se>2019-04-24 15:46:47 +0200
committerPeter Magnusson <peter@wselcon.se>2019-04-24 15:46:47 +0200
commit51224704728993f9825d538a0d50f5dd9312b22e (patch)
treef01a1cffb9fe2776f61ba6cfc82c3bae87bc152b
parentf5008037d4d0ebd479944d05f8f26bd01cbf6767 (diff)
downloadvyos-documentation-51224704728993f9825d538a0d50f5dd9312b22e.tar.gz
vyos-documentation-51224704728993f9825d538a0d50f5dd9312b22e.zip
Add sphinx-autobuild to docker
-rw-r--r--README.md23
-rw-r--r--docker/Dockerfile5
-rw-r--r--docs/Makefile10
3 files changed, 37 insertions, 1 deletions
diff --git a/README.md b/README.md
index 87484405..4815e495 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,17 @@ Required Debian Packages:
* `texlive-fonts-recommended`
* `texlive-latex-extra`
+### sphinx-autobuild
+Required extra setup procedure on Debian:
+```bash
+sudo apt-get install python-pip
+sudo pip install sphinx-autobuild
+```
+
+To build and run a webeserver, inside the `docs` folder:
+* `make livehtml` and browse to http://localhost:8000
+
+
## Docker
Using our [Dockerfile](docker/Dockerfile) you create your own Docker container
@@ -34,4 +45,16 @@ $ docker build -t vyos-docu docker
Linux
```bash
$ docker run --rm -it -v "$(pwd)":/vyos -w /vyos/docs -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) vyos-docu make html
+
+# sphinx autobuild
+$ docker run --rm -it -p 8000:8000 -v "$(pwd)":/vyos -w /vyos/docs -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) vyos-docu make livehtml
```
+
+Windows
+```powershell
+docker run --rm -it -v "$(pwd):/vyos" -w /vyos/docs vyos-docu make html
+
+# sphinx autobuild
+docker run --rm -it -p 8000:8000 -v "$(pwd):/vyos" -w /vyos/docs vyos-docu vyos-docu make livehtml
+```
+
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 06302f2b..7cd7c2e9 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -16,6 +16,7 @@ RUN apt-get update && apt-get install -y \
mc \
make \
python3-sphinx \
+ python3-pip \
python-sphinx-rtd-theme \
latexmk \
texlive-latex-recommended \
@@ -24,9 +25,13 @@ RUN apt-get update && apt-get install -y \
sudo \
gosu
+RUN pip3 install sphinx-autobuild
+
# Cleanup
RUN rm -rf /var/lib/apt/lists/*
+EXPOSE 8000
+
# Allow password-less 'sudo' for all users in group 'sudo'
RUN sed "s/^%sudo.*/%sudo\tALL=(ALL) NOPASSWD:ALL/g" -i /etc/sudoers && \
chmod a+s /usr/sbin/useradd /usr/sbin/groupadd /usr/sbin/gosu /usr/sbin/usermod
diff --git a/docs/Makefile b/docs/Makefile
index 6bf90e40..2b9976d5 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -8,6 +8,10 @@ SPHINXPROJ = VyOS
SOURCEDIR = .
BUILDDIR = _build
+AUTOHOST =0.0.0.0
+AUTOPORT =8000
+AUTOOPTS =--poll
+
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -17,4 +21,8 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+livehtml:
+ sphinx-autobuild --host $(AUTOHOST) --port $(AUTOPORT) $(AUTOOPTS) \
+ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file