[add] dockbook

This commit is contained in:
Andy Bunce 2022-01-29 22:58:33 +00:00
parent 416f324df8
commit 795b796643
2 changed files with 83 additions and 0 deletions

38
docbook/Dockerfile Normal file
View File

@ -0,0 +1,38 @@
FROM ubuntu:18.04
MAINTAINER Norman Tovey-Walsh <ndw@nwalsh.com>
RUN apt-get update
RUN apt-get dist-upgrade -y
RUN apt-get install -y default-jre maven unzip
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get update
RUN apt-get install -y python3.8 python3-pip
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10
# Use Maven to install the packages that docbook-xslTNG depends on
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=net.sf.saxon:Saxon-HE:10.6
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=com.drewnoakes:metadata-extractor:2.15.0
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=org.relaxng:jing:20181222
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=org.xmlresolver:xmlresolver:3.1.0
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=com.nwalsh:sinclude:4.0.0
RUN mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Dartifact=org.slf4j:slf4j-simple:1.7.30
ARG VERSION=1.6.0
WORKDIR /opt
ADD https://github.com/docbook/xslTNG/releases/download/${VERSION}/docbook-xslTNG-${VERSION}.zip .
RUN unzip docbook-xslTNG-${VERSION}.zip
WORKDIR docbook-xslTNG-${VERSION}
ENTRYPOINT ["bin/docbook"]

45
docbook/README Normal file
View File

@ -0,0 +1,45 @@
DocBook xslTNG version 1.6.0
This directory contains an experimental Dockerfile. Using docker
allows you to isolate the environment necessary to run the DocBook
xslTNG stylesheets from your local environment.
1. Build the docker image. In this directory, run the docker build
command:
docker build -t docbook-xslt .
The "-t" option provides a tag for the image; you can make this
anything you want. There's a VERSION build argument if you want
to build a particular release. For example,
docker build --build-arg VERSION=0.9.14 -t docbook-xslt .
will build a Docker image for the 0.9.14 release of the stylesheets
irrespective of the version in the Dockerfile.
2. Run the image, for example:
docker run docbook-xsltng samples/article.xml
If you chose a different tag when you built the image, use that tag
in place of 'docbook-xsltng' in the run command. Everything after the
container tag becomes options to the 'docbook' Python script.
Note that the context the script runs in is *inside* the container.
It can't for example, see your local filesystem.
You can use the Docker facilities for mounting directories to change
what documents the script can access. For example:
docker run -v /tmp:/output -v /path/to/samples:/input \
docbook-xsltng /input/article.xml chunk=index.html \
chunk-output-base-uri=/output/
Assuming that the 'samples' directory in the distribution is located
at /path/to/samples, this will chunk the article.xml sample document
that the script sees in /input (which is where you mounted samples)
and it will write the output to /output (which is where you mounted
/tmp).
When the script finishes, the chunked output will be in /tmp