From 108a297b84552948917d74ce3f26417f1d9c6834 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Mon, 9 Jun 2025 18:00:02 +0100 Subject: [PATCH] speed up docker build github actions Signed-off-by: Simon Smith --- .github/workflows/docker.yml | 33 ++++++++++++++++++++++++++++----- docker/Dockerfile | 2 +- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 82caccf5..ebad94ac 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,5 @@ name: Docker-Builder + on: push: branches: @@ -11,7 +12,9 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + check-token: + name: Check Token runs-on: ubuntu-latest outputs: token_defined: ${{ steps.token_check.outputs.token_defined }} @@ -22,16 +25,20 @@ jobs: MY_TOKEN: ${{ secrets.MY_TOKEN }} if: "${{ env.MY_TOKEN != '' }}" run: echo "token_defined=true" >> "$GITHUB_OUTPUT" + build: - name: Release + name: Build runs-on: ubuntu-latest needs: [check-token] if: needs.check-token.outputs.token_defined == 'true' steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 with: - fetch-depth: 0 + node-version: 'lts/*' - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -54,6 +61,22 @@ jobs: env: DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index + - name: Install Translate Packages (allowed to fail) + working-directory: ./translate + run: node translate.js || true + + - name: Run extractall + working-directory: ./translate + run: node translate.js extractall + + - name: Run minifyall + working-directory: ./translate + run: node translate.js minifyall + + - name: Run translateall + working-directory: ./translate + run: node translate.js translateall + - name: Build and push Docker image uses: docker/build-push-action@v6 with: @@ -68,8 +91,8 @@ jobs: INCLUDE_MONGODB_TOOLS=true INCLUDE_POSTGRESQL_TOOLS=true INCLUDE_MARIADB_TOOLS=true - DISABLE_MINIFY=no - DISABLE_TRANSLATE=no + DISABLE_MINIFY=yes + DISABLE_TRANSLATE=yes PREINSTALL_LIBS=true #- name: Docker Scout diff --git a/docker/Dockerfile b/docker/Dockerfile index 56ce95c5..cc901dce 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,7 +33,7 @@ RUN if [ -n "$DISABLE_MINIFY" ] || [ -n "$DISABLE_TRANSLATE" ]; then \ *) \ echo "Setting TRANSLATE as disabled.";; \ esac; \ - npm uninstall html-minifier jsdom esprima; \ + npm uninstall html-minifier-terser jsdom esprima; \ fi # Possible more updated alternative? @minify-html/node@0.15.0 -> https://www.npmjs.com/package/@minify-html/node