Skip to content

Commit

Permalink
Merge pull request #151 from tavip/lkt-docker-docs
Browse files Browse the repository at this point in the history
Add support for building documentation via docker
  • Loading branch information
tavip authored Mar 4, 2020
2 parents db1dd30 + f9efbb3 commit 5231d1b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 9 deletions.
15 changes: 13 additions & 2 deletions Documentation/sphinx/ditaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,18 @@ def setup(app):
#latex=(latex_visit_ditaa, None),
)
app.add_directive('ditaa', Ditaa)
app.add_config_value('ditaa', 'ditaa', 'html')
app.add_config_value('ditaa_args', [], 'html')

try:
ditaa_cmd = os.environ['SPHINX_DITAA_CMD']
except:
ditaa_cmd = 'ditaa'

try:
ditaa_arg = os.environ['SPHINX_DITAA_ARG'].split(':')
except:
ditaa_arg = []

app.add_config_value('ditaa', ditaa_cmd , 'html')
app.add_config_value('ditaa_args', ditaa_arg, 'html')
app.add_config_value('ditaa_log_enable', True, 'html')
app.connect('doctree-read', on_doctree_resolved)
12 changes: 10 additions & 2 deletions Documentation/teaching/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,22 @@ Computers, University POLITEHNICA of Bucharest.

You can get the latest version at http://github.com/linux-kernel-labs.

To get started build the documentation from the sources:
To get started build the documentation from the sources after
installing docker-compose on you host:

.. code-block:: c
cd tools/teaching && make docs
cd tools/teaching && make docker-docs
then point your browser at **Documentation/output/labs/index.html**.

Alternatively, you can build directly on the host (see
tools/labs/docs/Dockerfile for dependencies):

.. code-block:: c
cd tools/teaching && make docs
.. toctree::
:caption: Lectures

Expand Down
7 changes: 5 additions & 2 deletions tools/labs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ copy: $(YOCTO_IMAGE)
sudo umount $(TEMPDIR)
rmdir $(TEMPDIR)

docker-docs:
cd docs && docker-compose build
cd docs && docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"

docs:
pip install --user -r requirements.txt
$(MAKE) -C $(KDIR) DOCBOOKS= SPHINXDIRS="teaching" htmldocs
$(MAKE) -C $(KDIR) BUILDDIR=$(KDIR)/Documentation/output/slides DOCBOOKS= SPHINXDIRS="teaching" slides
for i in $(KDIR)/Documentation/output/slides/teaching/lectures/*.html; do name=$$(basename $$i .html); cp $$i $(KDIR)/Documentation/output/teaching/lectures/$$name-slides.html; done
Expand All @@ -45,4 +48,4 @@ clean::
clean_skels:
rm -rf skels

.PHONY: skels build copy docs clean clean_skels
.PHONY: skels build copy docs docker-docs clean clean_skels
26 changes: 26 additions & 0 deletions tools/labs/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y sudo
RUN apt-get install -y make
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get install -y ditaa
RUN apt-get install -y graphviz
RUN pip install Sphinx==1.6.7 sphinx_rtd_theme hieroglyph==1.0
# append new packages here, to minimize docker rebuild time
RUN rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash ubuntu && adduser ubuntu sudo && echo -n 'ubuntu:ubuntu' | chpasswd

# Enable passwordless sudo for users under the "sudo" group
RUN sed -i.bkp -e \
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
/etc/sudoers

USER ubuntu
WORKDIR /home/ubuntu/

ENV PATH ${PATH}:/home/ubuntu/.local
12 changes: 12 additions & 0 deletions tools/labs/docs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
docs-build:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../../../:/linux
environment:
# workaround for binfmt_misc support in containers
- SPHINX_DITAA_CMD=jexec
- SPHINX_DITAA_ARG=/usr/bin/ditaa
3 changes: 0 additions & 3 deletions tools/labs/requirements.txt

This file was deleted.

0 comments on commit 5231d1b

Please sign in to comment.