forked from goose-ws/docker-cups
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.44 KB
/
docker-image.yml
File metadata and controls
48 lines (42 loc) · 1.44 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
name: Build Printer Docker Image (ARM64)
on:
push:
branches: [ "main" ]
paths:
- 'Dockerfile'
- '.github/workflows/build-docker.yml'
pull_request:
branches: [ "main" ]
paths:
- 'Dockerfile'
- '.github/workflows/build-docker.yml'
workflow_dispatch: # 保留手动触发,无需架构选择(仅arm64)
jobs:
build-arm64:
name: Build ARM64 Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ARM64 Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/arm64 # 仅构建arm64架构
push: false # 不推送
tags: printer-cups:arm64-local # 明确的arm64标签
cache-from: type=gha,scope=arm64 # 单独的arm64缓存
cache-to: type=gha,scope=arm64,mode=max
# 关键:将构建的镜像导出为 tar 文件
outputs: type=docker,dest=/tmp/printer-cups-arm64.tar
- name: Compress image (减小体积)
run: gzip /tmp/printer-cups-arm64.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v4
with:
name: printer-cups-arm64-image
path: /tmp/printer-cups-arm64.tar.gz
retention-days: 3 # 镜像保留 天,可按需修改