Skip to content

chore: reduce the weight of the Docker image #100

chore: reduce the weight of the Docker image

chore: reduce the weight of the Docker image #100

Workflow file for this run

name: Publish Docker image
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- renovate/**
release:
types: [ published ]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} # <organization>/<repository>
BUILD_ARCHITECTURES: linux/amd64,linux/arm64
jobs:
build-image:
name: Build Docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
push: false
platforms: ${{ env.BUILD_ARCHITECTURES }}
cache-from: type=gha
cache-to: type=gha,mode=max
push-image:
name: Push images
runs-on: ubuntu-latest
needs: [ build-image ]
if: ${{ github.event_name == 'release' || github.ref_name == github.event.repository.default_branch}}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
context: git
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge,branch=${{ github.event.repository.default_branch }}
- uses: docker/build-push-action@v5
with:
push: true
platforms: ${{ env.BUILD_ARCHITECTURES }}
cache-from: type=gha
cache-to: type=gha,mode=max
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}