multiarch2 #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: multiarch2 | |
on: | |
# push: | |
workflow_dispatch: | |
env: | |
REGISTRY_IMAGE: mwader/static-ffmpeg:test- | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- runs_on: ubicloud-standard-8-arm | |
tag: arm64 | |
- runs_on: ubuntu-latest | |
tag: amd64 | |
runs-on: ${{ matrix.runs_on }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker build | |
run: docker build --tag image:${{ matrix.tag }} . | |
- name: Docker save | |
run: docker image save --output image-${{ matrix.tag }}.tar image:${{ matrix.tag }} | |
- name: Upload Docker image-${{ matrix.tag }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-${{ matrix.tag }} | |
path: image-${{ matrix.tag }}.tar | |
retention-days: 1 | |
tag: | |
name: Extract tag name | |
runs-on: ubuntu-latest | |
outputs: | |
TAG: ${{ steps.tag.outputs.result }} | |
steps: | |
- name: Extract the tag name | |
id: tag | |
uses: actions/github-script@0.2.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
return context.payload.ref === "refs/heads/master" | |
? 'latest' | |
: context.payload.ref.replace(/^refs\/(tags|heads)\//, ''); | |
merge: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- tag | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp | |
pattern: image-* | |
merge-multiple: true | |
- name: Load Docker images | |
run: | | |
docker image load --input /tmp/image-arm64.tar | |
docker image load --input /tmp/image-amd64.tar | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Create manifest list and push | |
run: | | |
docker manifest create \ | |
${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }} \ | |
--amend image:arm64 \ | |
--amend image:amd64 | |
docker manifest inspect ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }} | |
docker manifest push ${{ env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }} | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect {{ $env.REGISTRY_IMAGE }}${{ needs.tag.outputs.TAG }} |