Skip to content

Commit 8eac531

Browse files
committed
Try new multiarch
1 parent 09f05a4 commit 8eac531

File tree

2 files changed

+93
-6
lines changed

2 files changed

+93
-6
lines changed

.github/workflows/build-multiarch.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: "Build multi-arch image"
22

3-
on:
4-
push:
5-
branches:
6-
- 'master'
7-
tags:
8-
- '**'
3+
# on:
4+
# push:
5+
# branches:
6+
# - 'master'
7+
# tags:
8+
# - '**'
99

1010
jobs:
1111
tag:
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: multiarch2
2+
3+
on:
4+
# push:
5+
workflow_dispatch:
6+
7+
env:
8+
REGISTRY_IMAGE: mwader/static-ffmpeg:test-
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
include:
15+
- runs_on: ubicloud-standard-8-arm
16+
tag: arm64
17+
- runs_on: ubuntu-latest
18+
tag: amd64
19+
20+
runs-on: ${{ matrix.runs_on }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Docker build
24+
run: docker build --tag image:${{ matrix.tag }} .
25+
- name: Docker save
26+
run: docker image save --output image-${{ matrix.tag }}.tar image:${{ matrix.tag }}
27+
- name: Upload Docker image-${{ matrix.tag }}
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: image-${{ matrix.tag }}
31+
path: image-${{ matrix.tag }}.tar
32+
retention-days: 1
33+
34+
tag:
35+
name: Extract tag name
36+
runs-on: ubuntu-latest
37+
outputs:
38+
TAG: ${{ steps.tag.outputs.result }}
39+
steps:
40+
- name: Extract the tag name
41+
id: tag
42+
run: |
43+
jq -nr '
44+
( env.GITHUB_REF # refs/heads|tags/abc
45+
| split("/")[1:]
46+
| "result=" + if . == ["heads","master"] then "latest" else .[1] end
47+
)
48+
' >> "$GITHUB_OUTPUT"
49+
50+
merge:
51+
runs-on: ubuntu-latest
52+
needs:
53+
- build
54+
- tag
55+
steps:
56+
- name: Download digests
57+
uses: actions/download-artifact@v4
58+
with:
59+
path: /tmp
60+
pattern: image-*
61+
merge-multiple: true
62+
- name: Load Docker images
63+
run: |
64+
docker image load --input /tmp/image-arm64.tar
65+
docker image load --input /tmp/image-amd64.tar
66+
- name: Docker meta
67+
id: meta
68+
uses: docker/metadata-action@v5
69+
with:
70+
images: ${{ env.REGISTRY_IMAGE }}
71+
- name: Login to Docker Hub
72+
uses: docker/login-action@v3
73+
with:
74+
username: ${{ secrets.DOCKERHUB_USERNAME }}
75+
password: ${{ secrets.DOCKERHUB_TOKEN }}
76+
- name: Create manifest list and push
77+
run: |
78+
docker tag image:arm64 ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-arm64
79+
docker tag image:amd64 ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-amd64
80+
docker push ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-arm64
81+
docker push ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-amd64
82+
docker manifest create \
83+
${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }} \
84+
--amend ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-arm64 \
85+
--amend ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}-amd64
86+
docker manifest inspect ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}
87+
docker manifest push ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }}

0 commit comments

Comments
 (0)