From fc8b09c5fef9d31b8fb2907989ab79f1a44535f0 Mon Sep 17 00:00:00 2001 From: Javier Sepulveda Date: Mon, 30 Jan 2023 12:30:31 +0100 Subject: Conversion format from Bash to Docker: docs.git - Isolated --- docker/docs-build/Dockerfile | 24 ++++++++++++++++++++++-- docker/docs-build/build.sh | 2 +- docker/docs-build/requirements.txt | 1 - docker/docs-build/run.sh | 26 ++++++-------------------- 4 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 docker/docs-build/requirements.txt (limited to 'docker') diff --git a/docker/docs-build/Dockerfile b/docker/docs-build/Dockerfile index fe61794..5bcddce 100644 --- a/docker/docs-build/Dockerfile +++ b/docker/docs-build/Dockerfile @@ -1,7 +1,27 @@ +# Stage 1 + +FROM debian:bookworm-slim AS repo + +RUN apt update \ + && apt install --no-install-recommends -y ca-certificates git + +RUN git clone --branch=master --depth=1 https://git.taler.net/docs.git + +# Final image + FROM sphinxdoc/sphinx-latexpdf +# Copy content from one container to the other + WORKDIR /docs -ADD requirements.txt /docs +COPY --from=repo /docs . + +# Install dependencies + +RUN python3 -m pip install --no-cache-dir recommonmark + +# Compile /docs/* + +ENTRYPOINT ["make", "BUILDDIR=/output", "-C", "/docs", "html", "latexpdf"] -RUN pip3 install -r requirements.txt diff --git a/docker/docs-build/build.sh b/docker/docs-build/build.sh index 91182b2..0289932 100755 --- a/docker/docs-build/build.sh +++ b/docker/docs-build/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu diff --git a/docker/docs-build/requirements.txt b/docker/docs-build/requirements.txt deleted file mode 100644 index 02bf565..0000000 --- a/docker/docs-build/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -recommonmark diff --git a/docker/docs-build/run.sh b/docker/docs-build/run.sh index 33ba8a1..9f2eba6 100755 --- a/docker/docs-build/run.sh +++ b/docker/docs-build/run.sh @@ -1,28 +1,14 @@ -#!/bin/sh +#!/bin/bash set -eu -# Instead of git clone, use this pre-built function +# Execute the dockerfile, and leave output in local system -fetch () { - git clean -fdx - git fetch - # reset to updated upstream branch, but only if we're tracking a branch - branch=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo head) - git reset --hard "$branch" -} +docker run -v /home/docbuilder/docs:/output taler-docs-image -cd /home/docbuilder/docs/ +# COPY data from volume to local -fetch +cp -r /home/docbuilder/docs/html/* /home/docbuilder/build/docs/html +cp -r /home/docbuilder/docs/latex/*.pdf /home/docbuilder/build/docs/pdf -# Execute the container 2 times, and compile html and Latex pdf files -docker run -v /home/docbuilder/docs:/docs taler-docs-image make html - -docker run -v /home/docbuilder/docs:/docs taler-docs-image make latexpdf - -# COPY data from container volume -> to the server (html and pdf files) - -cp -r _build/html/* /home/docbuilder/build/docs/html -cp -r _build/latex/*.pdf /home/docbuilder/build/docs/pdf -- cgit v1.2.3