tools: add script for building documentation inside containers

This adds a script for building a container and building the
documentation within that new container image.

The openSUSE instructions now require a --non-interactive flag otherwise
they fail to run. Sadly there doesn't seem to be a way to have this in
an environment variable à-la DEBIAN_FRONTEND=noninteractive, so we
simply do a sed on the scripts to add --non-interactive to the zypper
commands to avoid having those in the instructions provided to our
users.

Somehow tzdata package in Ubuntu doesn't respect
DEBIAN_FRONTEND=noninteractive hence why the timezone needs to be set by
hand.

(From yocto-docs rev: cefced592f1302fcb65afa9e0b1f9f5ff1570e93)

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Antonin Godard <antonin.godard@bootlin.com>
Tested-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Quentin Schulz
2025-01-27 19:37:05 +01:00
committed by Richard Purdie
parent 9d7930a4e0
commit 7ea0561669
8 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning
FROM $ARG_FROM
ARG DOCS=opensuse_docs.sh
ARG DOCS_PDF=opensuse_docs_pdf.sh
ARG PIP3=pip3_docs.sh
# relative to the location of the dockerfile
COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh
COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh
COPY --chmod=777 ${PIP3} /temp/pip3_docs.sh
# Zypper doesn't have environment variables to specify whether to run in
# non-interactive mode like Debian does with DEBIAN_FRONTEND and piping yes to
# the scripts doesn't need to be enough as well, so let's force all zypper calls
# to be non-interactive by adding the appropriate flag in the scripts.
RUN for script in /temp/*.sh; do \
sed -i 's/zypper/zypper --non-interactive/' $script; \
done
RUN zypper update -y \
&& zypper install -y sudo \
&& yes | /temp/host_packages_docs.sh \
&& yes | /temp/host_packages_docs_pdf.sh \
&& yes | /temp/pip3_docs.sh \
&& zypper clean --all \
&& rm -rf /temp
RUN git config --global --add safe.directory /docs
ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"]
CMD ["publish"]