speed up docker build github actions

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith
2025-06-09 18:00:02 +01:00
parent 5044339c80
commit 108a297b84
2 changed files with 29 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
name: Docker-Builder name: Docker-Builder
on: on:
push: push:
branches: branches:
@@ -11,7 +12,9 @@ env:
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
check-token: check-token:
name: Check Token
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
token_defined: ${{ steps.token_check.outputs.token_defined }} token_defined: ${{ steps.token_check.outputs.token_defined }}
@@ -22,16 +25,20 @@ jobs:
MY_TOKEN: ${{ secrets.MY_TOKEN }} MY_TOKEN: ${{ secrets.MY_TOKEN }}
if: "${{ env.MY_TOKEN != '' }}" if: "${{ env.MY_TOKEN != '' }}"
run: echo "token_defined=true" >> "$GITHUB_OUTPUT" run: echo "token_defined=true" >> "$GITHUB_OUTPUT"
build: build:
name: Release name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [check-token] needs: [check-token]
if: needs.check-token.outputs.token_defined == 'true' if: needs.check-token.outputs.token_defined == 'true'
steps: steps:
- name: Checkout - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with: with:
fetch-depth: 0 node-version: 'lts/*'
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@@ -54,6 +61,22 @@ jobs:
env: env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index 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 - name: Build and push Docker image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
@@ -68,8 +91,8 @@ jobs:
INCLUDE_MONGODB_TOOLS=true INCLUDE_MONGODB_TOOLS=true
INCLUDE_POSTGRESQL_TOOLS=true INCLUDE_POSTGRESQL_TOOLS=true
INCLUDE_MARIADB_TOOLS=true INCLUDE_MARIADB_TOOLS=true
DISABLE_MINIFY=no DISABLE_MINIFY=yes
DISABLE_TRANSLATE=no DISABLE_TRANSLATE=yes
PREINSTALL_LIBS=true PREINSTALL_LIBS=true
#- name: Docker Scout #- name: Docker Scout

View File

@@ -33,7 +33,7 @@ RUN if [ -n "$DISABLE_MINIFY" ] || [ -n "$DISABLE_TRANSLATE" ]; then \
*) \ *) \
echo "Setting TRANSLATE as disabled.";; \ echo "Setting TRANSLATE as disabled.";; \
esac; \ esac; \
npm uninstall html-minifier jsdom esprima; \ npm uninstall html-minifier-terser jsdom esprima; \
fi fi
# Possible more updated alternative? @minify-html/node@0.15.0 -> https://www.npmjs.com/package/@minify-html/node # Possible more updated alternative? @minify-html/node@0.15.0 -> https://www.npmjs.com/package/@minify-html/node