This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
79 lines (66 loc) · 2.17 KB
/
multi-arch_images_build.yaml
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
---
name: Multiarch build
on:
workflow_dispatch:
env:
IMAGE_NAME: tang-operator
IMAGE_TAG: multi-arch
IMAGE_REGISTRY: quay.io
IMAGE_NAMESPACE: sec-eng-special
jobs:
build:
name: Build and push multi-arch image
runs-on: ubuntu-20.04
steps:
- name: add checkout action...
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build image linux/amd64
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: linux-amd64
arch: amd64
build-args: |
goarch=amd64
containerfiles: |
./Dockerfile
- name: Build image linux/ppc64le
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: linux-ppc64le
arch: ppc64le
build-args: |
goarch=ppc64le
containerfiles: |
./Dockerfile
- name: Build image linux/s390x
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: linux-s390x
arch: s390x
build-args: |
goarch=s390x
containerfiles: |
./Dockerfile
- name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}'
- name: Create and add to manifest
run: |
buildah manifest create ${{ env.IMAGE_NAME }}
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}:linux-amd64
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}:linux-ppc64le
buildah manifest add ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}:linux-s390x
# Authenticate to container image registry to push the image
- name: Podman Login
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PWD }}
- name: Push manifest
run: |
podman manifest push ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --all