Skip to content

Commit caa9e84

Browse files
committed
Switch to using ubicloud for multi arch build
ec2 spot instances kept failing too much
1 parent 09f05a4 commit caa9e84

File tree

3 files changed

+95
-44
lines changed

3 files changed

+95
-44
lines changed

.github/workflows/build-multiarch.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/multiarch.yml

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ See these references for further discussion and workarounds:
271271
](https://github.com/openssl/openssl/discussions/23016)
272272
- [OpenSSL issue with binary outside container (RedHat/Fedora specific)](https://github.com/wader/static-ffmpeg/issues/462)
273273

274-
### Docker Hub images
274+
### Thanks
275275

276-
Multi-arch dockerhub images are built using [pyldin601/build-multiarch-on-aws-spots](https://github.com/pyldin601/build-multiarch-on-aws-spots). See [build-multiarch.yml](.github/workflows/build-multiarch.yml) for config. Thanks to [@pyldin601](https://github.com/pyldin601) for making this possible.
276+
- [@pyldin601](https://github.com/pyldin601) for working on multi arch builds
277277

278278
### Contribute
279279

0 commit comments

Comments
 (0)