mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-03-15 08:13:16 +08:00
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: Build Docker Base Image
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- 'Dockerfile.builder'
|
|
- 'Dockerfile.runtime'
|
|
- 'install_dependencies.sh'
|
|
- '.github/workflows/build-base-image.yml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-image:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'pull_request'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
image-type: [runtime, builder]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and push ${{ matrix.image-type }}
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.${{ matrix.image-type }}
|
|
platforms: linux/amd64, linux/arm64, linux/arm/v7
|
|
push: true
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:${{ matrix.image-type }}
|
|
# 核心缓存配置:每个镜像类型使用独立缓存标签
|
|
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache-${{ matrix.image-type }}
|
|
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache-${{ matrix.image-type }},mode=max
|