-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 3.54 KB
/
containerd_build.yml
File metadata and controls
105 lines (93 loc) · 3.54 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build and Push containerd Images
on:
schedule:
- cron: "0 17 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
fail-fast: false
matrix:
include:
- system: ubuntu
dockerfile: Dockerfile_ubuntu
tag_prefix: ubuntu
- system: debian
dockerfile: Dockerfile_debian
tag_prefix: debian
- system: alpine
dockerfile: Dockerfile_alpine
tag_prefix: alpine
- system: almalinux
dockerfile: Dockerfile_almalinux
tag_prefix: almalinux
- system: rockylinux
dockerfile: Dockerfile_rockylinux
tag_prefix: rockylinux
- system: openeuler
dockerfile: Dockerfile_openeuler
tag_prefix: openeuler
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU (multi-arch)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export amd64 tar
run: |
docker buildx build \
--platform linux/amd64 \
--file dockerfiles/${{ matrix.dockerfile }} \
--tag spiritlhl/${{ matrix.tag_prefix }}:latest \
--output type=docker \
dockerfiles/
docker save spiritlhl/${{ matrix.tag_prefix }}:latest | gzip > spiritlhl_${{ matrix.tag_prefix }}_amd64.tar.gz
echo "amd64 tar size: $(du -sh spiritlhl_${{ matrix.tag_prefix }}_amd64.tar.gz)"
- name: Build and export arm64 tar
run: |
docker buildx build \
--platform linux/arm64 \
--file dockerfiles/${{ matrix.dockerfile }} \
--tag spiritlhl/${{ matrix.tag_prefix }}:latest \
--output type=docker \
dockerfiles/
docker save spiritlhl/${{ matrix.tag_prefix }}:latest | gzip > spiritlhl_${{ matrix.tag_prefix }}_arm64.tar.gz
echo "arm64 tar size: $(du -sh spiritlhl_${{ matrix.tag_prefix }}_arm64.tar.gz)"
- name: Upload amd64 tar to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: spiritlhl_${{ matrix.tag_prefix }}_amd64.tar.gz
asset_name: spiritlhl_${{ matrix.tag_prefix }}_amd64.tar.gz
tag: ${{ matrix.tag_prefix }}
overwrite: true
body: "containerd image for ${{ matrix.tag_prefix }} (amd64 + arm64)"
- name: Upload arm64 tar to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: spiritlhl_${{ matrix.tag_prefix }}_arm64.tar.gz
asset_name: spiritlhl_${{ matrix.tag_prefix }}_arm64.tar.gz
tag: ${{ matrix.tag_prefix }}
overwrite: true
body: "containerd image for ${{ matrix.tag_prefix }} (amd64 + arm64)"
- name: Push multi-arch image to GHCR
uses: docker/build-push-action@v5
with:
context: dockerfiles/
file: dockerfiles/${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.tag_prefix }}:latest