Skip to content

Docker build optimise #12

Docker build optimise

Docker build optimise #12

Workflow file for this run

name: Build Docker image
on:
push:
branches: [master]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-build:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha,prefix=sha-
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=docker-${{ github.workflow }}
cache-to: type=gha,mode=max,scope=docker-${{ github.workflow }}