-
Notifications
You must be signed in to change notification settings - Fork 13
57 lines (48 loc) · 1.43 KB
/
Copy pathdocker.yml
File metadata and controls
57 lines (48 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and Push Multi-Arch Image (GHCR)
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# 1. 拉代码
- name: Checkout
uses: actions/checkout@v4
# 2. 启用 QEMU(支持 ARM 模拟)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# 3. 启用 Buildx(多架构构建核心)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 4. 登录 GHCR(无需 secrets,自动用 GITHUB_TOKEN)
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 5. 生成镜像标签
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/nowen-reader
tags: |
type=raw,value=latest
type=sha
# 6. 构建并推送(ARM + amd64)
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max