Docker Image CI #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
tags: | |
- "*_rc" | |
- "*_beta" | |
jobs: | |
docker-hub: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux/amd64", "linux/arm64"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU # 新增模拟器支持 ARM 架构 | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx # 启用多架构构建工具链 | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: xcsoft | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ matrix.platform }} # 动态指定构建平台 | |
push: true | |
tags: | | |
xcsoft/busuanzi:${{ github.ref_name }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} | |
xcsoft/busuanzi:latest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} | |
github-docker: | |
runs-on: ubuntu-latest | |
strategy: # 同步添加多架构策略 | |
matrix: | |
platform: ["linux/amd64", "linux/arm64"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: true | |
tags: | | |
ghcr.io/soxft/busuanzi:${{ github.ref_name }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} | |
ghcr.io/soxft/busuanzi:latest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} |