feat: add more image tag

This commit is contained in:
engigu
2026-02-06 21:37:35 +08:00
parent a04d599b16
commit 60d6fb2525
15 changed files with 102 additions and 16 deletions
+47 -8
View File
@@ -6,7 +6,7 @@ on:
branches:
- main
paths:
- 'Dockerfile.base'
- 'docker/Dockerfile.base'
env:
REGISTRY: ghcr.io
@@ -17,10 +17,39 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
base_type: [debian, alpine, debian13]
platform:
- linux/amd64
- linux/arm64
- linux/arm/v7
include:
- base_type: debian
platform: linux/arm/v7
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: debian
platform: linux/amd64
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: debian
platform: linux/arm64
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: alpine
platform: linux/amd64
dockerfile: docker/Dockerfile.alpine.base
tag_suffix: "-alpine"
- base_type: alpine
platform: linux/arm64
dockerfile: docker/Dockerfile.alpine.base
tag_suffix: "-alpine"
- base_type: debian13
platform: linux/amd64
dockerfile: docker/Dockerfile.debian13.base
tag_suffix: "-debian13"
- base_type: debian13
platform: linux/arm64
dockerfile: docker/Dockerfile.debian13.base
tag_suffix: "-debian13"
permissions:
contents: read
@@ -34,7 +63,7 @@ jobs:
id: platform
run: |
platform=${{ matrix.platform }}
echo "pair=${platform//\//-}" >> $GITHUB_OUTPUT
echo "pair=${platform//\//-}-${{ matrix.base_type }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -56,14 +85,14 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=base
type=raw,value=base${{ matrix.tag_suffix }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.base
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
@@ -88,6 +117,16 @@ jobs:
merge:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
base_type: [debian, alpine, debian13]
include:
- base_type: debian
tag: base
- base_type: alpine
tag: base-alpine
- base_type: debian13
tag: base-debian13
permissions:
contents: read
@@ -101,7 +140,7 @@ jobs:
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
pattern: digests-*-${{ matrix.base_type }}
merge-multiple: true
- name: Set up Docker Buildx
@@ -121,7 +160,7 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=base
type=raw,value=${{ matrix.tag }}
- name: Create manifest list and push
working-directory: /tmp/digests
@@ -131,4 +170,4 @@ jobs:
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:base
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}