From 3ec0b3a9b9a05046990ef646e6f1d79131cb7dd2 Mon Sep 17 00:00:00 2001 From: orensbruli Date: Wed, 17 Jan 2024 09:41:31 +0100 Subject: [PATCH 1/2] Improve dockerfile layers --- .gitignore | 4 ++++ Dockerfile | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 9927442..db2d655 100644 --- a/.gitignore +++ b/.gitignore @@ -276,3 +276,7 @@ TSWLatexianTemp* *.lpz build/ + +*.pdf + +*.eps diff --git a/Dockerfile b/Dockerfile index 5f590a1..bb41acb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ - # Use an official Ubuntu base image FROM ubuntu:22.04 # Avoid prompts from apt ENV DEBIAN_FRONTEND=noninteractive -# Install LaTeX packages +# Install LaTeX packages and other dependencies in one RUN command to minimize layers RUN apt-get update && apt-get install -y \ make \ pandoc \ @@ -17,21 +16,20 @@ RUN apt-get update && apt-get install -y \ texlive-luatex \ texlive-pstricks \ texlive-xetex \ - wget - -RUN wget --output-document=/usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && \ - chmod +x /usr/local/bin/yq && \ - yq --version - -RUN apt-get update && apt-get install -y \ - fonts-roboto-slab - -RUN apt-get update && apt-get install -y \ + wget \ + fonts-roboto-slab \ ghostscript \ python3 \ - python3-pip + python3-pip \ + && wget --output-document=/usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ + && chmod +x /usr/local/bin/yq \ + && yq --version \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* # bind mount requirements.txt and install python dependencies +# Note: This will only work during a Docker build if you use BuildKit, otherwise, you need to copy the requirements.txt file +# and run pip install as a separate step during container runtime. RUN --mount=type=bind,target=/latex_content pip3 install -r /latex_content/requirements.txt # Set working directory From 1e9bdd3fffeed73e7d6d3defce93c268bd57c0f8 Mon Sep 17 00:00:00 2001 From: orensbruli Date: Wed, 17 Jan 2024 09:42:24 +0100 Subject: [PATCH 2/2] Remove unnecesary docker cache --- .github/workflows/github_action_build.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index 4269b95..3e2fc97 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -14,14 +14,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -38,7 +30,7 @@ jobs: - name: Upload PDF as Artifact uses: actions/upload-artifact@v4 with: - name: compiled-pdf + name: compiled-pdf-${{ github.ref_slug }} path: output.pdf - name: Upload binaries to release