speedup image compile

This commit is contained in:
Alberto Xamin 2024-12-30 16:10:12 +01:00 committed by GitHub
parent b45d04bf30
commit 123e569010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,18 +6,21 @@ on:
jobs: jobs:
buildx: buildx:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm/v7, linux/arm64/v8]
steps: steps:
- - name: Checkout
name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
-
name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
-
name: Cache Docker layers - name: Cache Docker layers
uses: actions/cache@v4 uses: actions/cache@v4
id: cache id: cache
with: with:
@ -25,20 +28,21 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
-
name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
- name: Build and push multi-arch image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: linux/arm/v7,linux/amd64 platforms: ${{ matrix.platform }}
push: true push: true
tags: albertoxamin/bang:latest tags: albertoxamin/bang:latest
cache-from: type=registry,ref=user/app:latest cache-from: type=registry,ref=albertoxamin/bang:latest
cache-to: type=inline cache-to: type=inline
- name: Notify discord - name: Notify discord
@ -47,5 +51,5 @@ jobs:
env: env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
GITHUB_ACTOR: ${{ github.actor }} GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: "Docker image main :latest" GITHUB_JOB_NAME: "Docker multi-arch image :latest"
GITHUB_JOB_STATUS: ${{ job.status }} GITHUB_JOB_STATUS: ${{ job.status }}