Files
TaskPool/.github/workflows/docker-arm64.yml
T
2026-06-25 21:33:50 +08:00

90 lines
2.4 KiB
YAML

name: Build-Docker-ARM64
# on:
# # push:
# # tags: [ 'v*' ]
# workflow_dispatch:
on:
push:
branches: [ main, dev ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
base_type: [debian, debian13, minimal]
include:
- base_type: debian
base_tag: base
tag_suffix: ""
# - base_type: alpine
# base_tag: base-alpine
# tag_suffix: "-alpine"
- base_type: debian13
base_tag: base-debian13
tag_suffix: "-debian13"
- base_type: minimal
base_tag: base-minimal
tag_suffix: "-minimal"
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=ref,event=branch,suffix=-arm64${{ matrix.tag_suffix }}
- name: Get build time
id: build_time
run: echo "time=$(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.base_type == 'minimal' && './docker/Dockerfile.minimal' || './docker/Dockerfile' }}
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ github.ref_name }}
BUILD_TIME=${{ steps.build_time.outputs.time }}
BASE_TAG=${{ matrix.base_tag }}
cache-from: type=gha,scope=linux-arm64-${{ matrix.base_type }}
cache-to: type=gha,scope=linux-arm64-${{ matrix.base_type }},mode=max
provenance: false