Skip to content

Commit

Permalink
feature: ZENKO-1405 setting up docker env for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Dec 21, 2018
1 parent 2fb94cd commit 6415337
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.tox
docs/_build
3 changes: 3 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install --no-install-recommends -y \
enchant \
emacs \
git \
inkscape \
latexmk \
Expand All @@ -20,6 +21,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
texlive-latex-extra \
texlive-latex-recommended \
tox \
vim \
xindy \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down
20 changes: 17 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ SPHINXPROJ = Zenko
SOURCEDIR = .
BUILDDIR = _build


ROOTDIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
DOCKER=docker
BUILDERNAME=zenko-docs
BUILDERIMAGE="$(ROOTDIR)/.."
BUILDERDOCKERFILE=./Dockerfile
BUILDERHOME=/usr/src/zenko

.PHONY: build shell help Makefile

build:
@$(DOCKER) build -t $(BUILDERNAME):latest -f $(BUILDERDOCKERFILE) $(BUILDERIMAGE)

shell: build
@$(DOCKER) run -it --rm -v "$(ROOTDIR)/..:$(BUILDERHOME)" --entrypoint=bash $(BUILDERNAME)

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# 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)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
30 changes: 16 additions & 14 deletions docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

pushd %~dp0

REM docker build setup

set DOCKER=docker
set BUILDERNAME=zenko-docs
set BUILDERIMAGE=..\
set BUILDERDOCKERFILE=.\Dockerfile
set BUILDERHOME=/usr/src/zenko


REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
Expand All @@ -13,24 +22,17 @@ set SPHINXPROJ=Zenko

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
REM create a docker container work environment
:shell
%DOCKER% build -t %BUILDERNAME%:latest -f %BUILDERDOCKERFILE% %BUILDERIMAGE%
%DOCKER% run -it --rm -v "%~dp0\..:%BUILDERHOME%" -v "C:\:/c" --entrypoint=bash %BUILDERNAME%

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd

0 comments on commit 6415337

Please sign in to comment.