forked from konveyor/tackle2-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (115 loc) · 3.63 KB
/
image-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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Multiple Architecture Image Build
on:
workflow_dispatch:
push:
branches:
- "main"
- "release-*"
tags:
- "v*"
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
tag: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }}
# what is normally sent in as input
registry: "quay.io/sdickers"
image_name: "tackle2-ui"
containerfile: "./Dockerfile"
extra-args: "--ulimit nofile=4096:4096"
# pre_build_cmd: |
# echo "registry=\"http://localhost:4873\"" >> .npmrc
# pre_build_cmd: |
# echo "registry=https://npm.pkg.github.com" >> .npmrc
jobs:
build:
runs-on: ubuntu-latest
# setup a npm mirror server so multiple npm installs can share fetches
# services:
# npm-mirror:
# image: verdaccio/verdaccio:5
# ports:
# - 4873:4873
strategy:
matrix:
architecture:
- "amd64"
- "arm64"
- "ppc64le"
- "s390x"
steps:
- name: Maximize disk space
shell: bash
run: |
echo "Space before clearing:"
df . -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Space after clearing:"
df . -h
- name: Checkout
uses: actions/checkout@main
- name: Configure QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Image meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.registry }}/${{ env.image_name }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Run pre build command
shell: bash
run: "${{ env.pre_build_cmd }}"
if: "${{ env.pre_build_cmd != '' }}"
- name: Build Image
id: build
uses: redhat-actions/buildah-build@main
with:
image: ${{ env.image_name }}
tags: ${{ env.tag }}-${{ matrix.architecture }}
extra-args: "--no-cache --rm ${{ env.extra-args }}"
archs: ${{ matrix.architecture }}
labels: ${{ steps.meta.outputs.labels }}
containerfiles: ${{ env.containerfile }}
- name: Push To Quay
uses: redhat-actions/push-to-registry@main
id: push
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ env.tag }}-${{ matrix.architecture }}
username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
registry: ${{ env.registry }}
manifest:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create manifest
shell: bash
run: |
podman manifest create "${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}"
for arch in $(echo '${{ env.architectures }}' | jq -r '.[]'); do
podman manifest add \
"${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}" \
"${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}-${arch}"
done
- name: Push To Quay
uses: redhat-actions/push-to-registry@main
id: push
with:
image: ${{ env.image_name }}
tags: ${{ env.tag }}
username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
registry: ${{ env.registry }}