From 46ab05048e3b38fd2b3f400bd1f19d3631e2305c Mon Sep 17 00:00:00 2001 From: Hendrik Kleinwaechter Date: Sun, 9 Jul 2023 15:05:30 +0200 Subject: [PATCH] Fix Docker workflow issues (hopefully) (#143) This hopefully fixes some of the issues of the docker workflow building the book and website --- .github/workflows/release-book.yml | 24 ++++++++++++++--- .github/workflows/release-website.yml | 24 ++++++++++++++--- .github/workflows/validate-book-build.yml | 32 +++++++++++++++++++++++ .github/workflows/validate.yml | 14 ---------- Dockerfile | 21 +++++---------- makefile | 26 ++++++++++++++---- 6 files changed, 102 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/validate-book-build.yml delete mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/release-book.yml b/.github/workflows/release-book.yml index 1f2af5b..f10092b 100644 --- a/.github/workflows/release-book.yml +++ b/.github/workflows/release-book.yml @@ -9,11 +9,29 @@ jobs: steps: - name: Set up git repository uses: actions/checkout@v3 - - name: Bake the book - uses: docker://ghcr.io/hendricius/the-sourdough-framework:latest + - name: Print dependency versions + uses: addnab/docker-run-action@v3 with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app run: | - cd book + cd /app/book + make show_tools_version + - name: Print build variables + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book + make printvars + - name: Bake the book + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book make bake - name: Release baked book to S3 uses: shallwefootball/s3-upload-action@master diff --git a/.github/workflows/release-website.yml b/.github/workflows/release-website.yml index 491d759..d9bfe86 100644 --- a/.github/workflows/release-website.yml +++ b/.github/workflows/release-website.yml @@ -9,11 +9,29 @@ jobs: steps: - name: Set up git repository uses: actions/checkout@v3 - - name: Bake the book - uses: docker://ghcr.io/hendricius/the-sourdough-framework:latest + - name: Print dependency versions + uses: addnab/docker-run-action@v3 with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app run: | - cd book + cd /app/book + make show_tools_version + - name: Print build variables + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book + make printvars + - name: Bake the book + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book make website - name: Release baked website to S3 uses: shallwefootball/s3-upload-action@master diff --git a/.github/workflows/validate-book-build.yml b/.github/workflows/validate-book-build.yml new file mode 100644 index 0000000..7eb4859 --- /dev/null +++ b/.github/workflows/validate-book-build.yml @@ -0,0 +1,32 @@ +name: Validate LaTeX Document +on: [ push, pull_request ] +jobs: + test_building_book: + runs-on: ubuntu-latest + steps: + - name: Set up git repository + uses: actions/checkout@v3 + - name: Print dependency versions + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book + make show_tools_version + - name: Print build variables + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book + make printvars + - name: Test baking the release versions + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/hendricius/the-sourdough-framework:latest + options: -v ${{ github.workspace }}:/app + run: | + cd /app/book + make -j build_pdf build_serif_ebook diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index cb9f486..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Validate LaTeX Document -on: [ push, pull_request ] -jobs: - test_building_book: - runs-on: ubuntu-latest - steps: - - name: Set up git repository - uses: actions/checkout@v3 - - name: Test baking the release versions - uses: docker://ghcr.io/hendricius/the-sourdough-framework:latest - with: - run: | - cd book - make -j build_pdf build_serif_ebook diff --git a/Dockerfile b/Dockerfile index 56878df..000ff1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:latest +FROM ubuntu:rolling LABEL "maintainer"="Hendrik Kleinwächter " LABEL "repository"="https://github.com/hendricius/the-sourdough-framework" @@ -15,10 +15,9 @@ RUN apt-get update && \ git \ wget -# Install LaTeX +# Install base LaTeX system RUN apt-get install --yes -y --no-install-recommends \ - texlive-full \ - texlive-lang-all + texlive-full # Install LaTeX extras RUN apt-get install --yes -y --no-install-recommends \ @@ -28,19 +27,13 @@ RUN apt-get install --yes -y --no-install-recommends \ tex-gyre \ fonts-texgyre \ dvisvgm \ - context + context \ + python3-pygments \ + python3-setuptools RUN apt-get autoclean && apt-get --purge --yes autoremove -# Custom TeX packages on latest version -RUN git clone https://github.com/michal-h21/make4ht && \ - cd make4ht && \ - make justinstall SUDO="" - -RUN git clone https://github.com/michal-h21/tex4ebook.git && \ - cd tex4ebook && \ - make && \ - make install SUDO="" +WORKDIR /root # Support to build amazon kindle books RUN wget https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz && \ diff --git a/makefile b/makefile index 622820f..55f6910 100644 --- a/makefile +++ b/makefile @@ -1,25 +1,41 @@ DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework .PHONY: build_pdf -build_pdf: build_docker_image +build_pdf: mrproper docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make" .PHONY: bake -bake: build_docker_image +bake: mrproper docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make bake" .PHONY: build_docker_image build_docker_image: - docker build -t $(DOCKER_IMAGE) -f Dockerfile --platform linux/amd64 . + docker build -t $(DOCKER_IMAGE) -f Dockerfile . .PHONY: push_docker_image push_docker_image: docker push $(DOCKER_IMAGE):latest .PHONY: website -website: +website: mrproper docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make website" .PHONY: validate -validate: +validate: mrproper docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_serif_ebook" + +.PHONY: mrproper +mrproper: + docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make mrproper" + +.PHONY: show_tools_version +show_tools_version: + docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make show_tools_version" + +.PHONY: printvars +printvars: + docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make printvars" + +.PHONY: start_shell +start_shell: + docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash \ No newline at end of file